﻿/*
Deployment script for EnviroDB
*/

GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;

SET NUMERIC_ROUNDABORT OFF;


GO
:setvar DatabaseName "EnviroDB"
:setvar DefaultDataPath ""

GO
USE [master]

GO
:on error exit
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL
    AND DATABASEPROPERTYEX(N'$(DatabaseName)','Status') <> N'ONLINE')
BEGIN
    RAISERROR(N'The state of the target database, %s, is not set to ONLINE. To deploy to this database, its state must be set to ONLINE.', 16, 127,N'$(DatabaseName)') WITH NOWAIT
    RETURN
END

GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL) 
BEGIN
    ALTER DATABASE [$(DatabaseName)]
    SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    DROP DATABASE [$(DatabaseName)];
END

GO
PRINT N'Creating $(DatabaseName)...'
GO
CREATE DATABASE [$(DatabaseName)]
    ON 
    PRIMARY(NAME = [EnviroDB], FILENAME = '$(DefaultDataPath)$(DatabaseName).mdf', SIZE = 57344 KB, MAXSIZE = UNLIMITED, FILEGROWTH = 1024 KB)
    LOG ON (NAME = [EnviroDB_log], FILENAME = '$(DefaultDataPath)$(DatabaseName)_log.ldf', SIZE = 470144 KB, MAXSIZE = 2097152 MB, FILEGROWTH = 10 %)
GO
EXECUTE sp_dbcmptlevel [$(DatabaseName)], 100;


GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET ANSI_NULLS ON,
                ANSI_PADDING ON,
                ANSI_WARNINGS ON,
                ARITHABORT ON,
                CONCAT_NULL_YIELDS_NULL ON,
                NUMERIC_ROUNDABORT OFF,
                QUOTED_IDENTIFIER ON,
                ANSI_NULL_DEFAULT ON,
                CURSOR_DEFAULT LOCAL,
                RECOVERY FULL,
                CURSOR_CLOSE_ON_COMMIT OFF,
                AUTO_CREATE_STATISTICS ON,
                AUTO_SHRINK OFF,
                AUTO_UPDATE_STATISTICS ON,
                RECURSIVE_TRIGGERS OFF 
            WITH ROLLBACK IMMEDIATE;
        ALTER DATABASE [$(DatabaseName)]
            SET AUTO_CLOSE OFF 
            WITH ROLLBACK IMMEDIATE;
    END


GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET ALLOW_SNAPSHOT_ISOLATION OFF;
    END


GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET READ_COMMITTED_SNAPSHOT OFF;
    END


GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET AUTO_UPDATE_STATISTICS_ASYNC OFF,
                PAGE_VERIFY NONE,
                DATE_CORRELATION_OPTIMIZATION OFF,
                DISABLE_BROKER,
                PARAMETERIZATION SIMPLE 
            WITH ROLLBACK IMMEDIATE;
    END


GO
IF IS_SRVROLEMEMBER(N'sysadmin') = 1
    BEGIN
        IF EXISTS (SELECT 1
                   FROM   [master].[dbo].[sysdatabases]
                   WHERE  [name] = N'$(DatabaseName)')
            BEGIN
                EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)]
    SET TRUSTWORTHY ON,
        DB_CHAINING OFF 
    WITH ROLLBACK IMMEDIATE';
            END
    END
ELSE
    BEGIN
        PRINT N'The database settings for DB_CHAINING or TRUSTWORTHY cannot be modified. You must be a SysAdmin to apply these settings.';
    END


GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        ALTER DATABASE [$(DatabaseName)]
            SET HONOR_BROKER_PRIORITY OFF 
            WITH ROLLBACK IMMEDIATE;
    END


GO
USE [$(DatabaseName)]

GO
IF fulltextserviceproperty(N'IsFulltextInstalled') = 1
    EXECUTE sp_fulltext_database 'enable';


GO

GO
/*
 Pre-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be executed before the build script.	
 Use SQLCMD syntax to include a file in the pre-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the pre-deployment script.		
 Example:      :setvar TableName MyTable							
               SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/

GO

GO
PRINT N'Creating ODCollections...';


GO
CREATE SCHEMA [ODCollections]
    AUTHORIZATION [dbo];


GO
PRINT N'Creating ODCore...';


GO
CREATE SCHEMA [ODCore]
    AUTHORIZATION [dbo];


GO
PRINT N'Creating ODData...';


GO
CREATE SCHEMA [ODData]
    AUTHORIZATION [dbo];


GO
PRINT N'Creating ODExtensibility...';


GO
CREATE SCHEMA [ODExtensibility]
    AUTHORIZATION [dbo];


GO
PRINT N'Creating ODTranslation...';


GO
CREATE SCHEMA [ODTranslation]
    AUTHORIZATION [dbo];


GO
PRINT N'Creating MSR.SpatialData...';


GO
CREATE ASSEMBLY [MSR.SpatialData]
    AUTHORIZATION [dbo]
    FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C0103000312E3490000000000000000E00002210B010800003400000006000000000000DE53000000200000006000000000400000200000000200000400000000000000040000000000000000A000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000905300004B000000006000004003000000000000000000000000000000000000008000000C000000FC5200001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000E4330000002000000034000000020000000000000000000000000000200000602E7273726300000040030000006000000004000000360000000000000000000000000000400000402E72656C6F6300000C0000000080000000020000003A00000000000000000000000000004000004200000000000000000000000000000000C0530000000000004800000002000500F4300000082200000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000133001000C0000000100001100027B010000040A2B00062A133003007601000002000011000F00281600000A16FE01130A110A2D0C2806000006130938560100001200FE15020000020F00281700000A6F1800000A0B0772010000706F1900000A6F1A00000A0C08169A6F1800000A6F1B00000A7205000070281C00000A16FE01130A110A2D10001200720F0000707D03000004002B0C007219000070731D00000A7A08179A72AE01007072B20100706F1E00000A0D0972B40100706F1900000A6F1A00000A1304161305161306388F00000000110411069A72B80100706F1900000A6F1A00000A1307110516FE0116FE01130A110A2D080011078E69130500110511078E69FE0116FE01130A110A2D3E001613082B2900110711089A6F1800000A2804000006130A110A2D0C0072BC010070731D00000A7A0011081758130811081105FE04130A110A2DCB002B0C007210020070731D00000A7A00110617581306110611048E69FE04130A110A3A60FFFFFF12000F01281F00000A130B120B282000000A7D040000041200097D020000040613092B0011092A0000133003004401000003000011000F00281600000A16FE01130811082D0C2806000006130738240100001200FE15020000020F00281700000A6F1800000A0B0772010000706F1900000A6F1A00000A0C08169A6F1800000A6F1B00000A7259030070281C00000A16FE01130811082D1000120072690300707D03000004002B0C007279030070731D00000A7A120022000000007D0400000408179A72AE01007072B20100706F1E00000A0D0972B40100706F1900000A6F1A00000A13041613052B7100110411059A72B80100706F1900000A6F1A00000A130611068E6918FE0116FE01130811082D37001106169A6F1800000A28040000062C101106179A6F1800000A28040000062B0116130811082D0C0072AC040070731D00000A7A002B0C00724B060070731D00000A7A00110517581305110511048E69FE04130811082D811200097D020000040613072B0011072A1B30010024000000040000110022000000000A160B0002282100000A0A170B00DE070C00160B00DE0000070D2B00092A01100000000009000D16000727000001133003004401000003000011000F00281600000A16FE01130811082D0C2806000006130738240100001200FE15020000020F00281700000A6F1800000A0B0772010000706F1900000A6F1A00000A0C08169A6F1800000A6F1B00000A721A080070281C00000A16FE01130811082D10001200722C0800707D03000004002B0C00723E080070731D00000A7A08179A72AE01007072B20100706F1E00000A0D0972B40100706F1900000A6F1A00000A13041613052B7100110411059A72B80100706F1900000A6F1A00000A130611068E6918FE0116FE01130811082D37001106169A6F1800000A28040000062C101106179A6F1800000A28040000062B0116130811082D0C007243090070731D00000A7A002B0C0072A20A0070731D00000A7A00110517581305110511048E69FE04130811082D81120022000000007D040000041200097D020000040613072B0011072A133002001700000005000011001200FE15020000021200177D01000004060B2B00072A00133005006D0000000600001100198D260000010D0916722C080070A209177269030070A20918720F000070A2090A02280100000616FE01130411042D0872330C00700C2B3200732200000A0B07027B030000047201000070027B0200000472AE010070282300000A6F2400000A26076F2500000A0C2B00082A000000133001001600000007000011000271020000028C02000002282600000A0A2B00062A0000133003002D0000000800001100198D260000010C0816722C080070A208177269030070A20818720F000070A2080A027B030000040B2B00072A260002037D030000042A00133001000C0000000700001100027B020000040A2B00062A260002037D020000042A0000133002002500000009000011000F00281600000A16FE010C082D0828060000060B2B0C1200FE1502000002060B2B00072A0000000330020043000000000000000003027B040000046F2700000A0003027B030000046F2800000A0003027B020000046F2800000A0003027B060000046F2900000A0003027B050000046F2900000A002AFA0002036F2A00000A7D0400000402036F2B00000A7D0300000402036F2B00000A7D0200000402036F2C00000A7D0600000402036F2C00000A7D050000042A0000133001000C0000000A00001100027B040000040A2B00062A260002037D040000042A000013300200360000000B000011000274050000020A04067B0F000004810900000105067B0E000004810900000103067B0D00000481020000020E04067B0C000004512A0000133005004B0600000C00001100732E00000A0A020328150000060D097B08000004282F00000A097B07000004282F00000A733000000A1304161305161306230000000000000000130723000000000000000013082300000000000000001309230000000000000000130A0F00FE16050000016F2500000A733100000A130B14130C16130D383401000000110C178D2D00000113251125161F209D11256F1A00000A130E16130F2B7500110D1BFE0216FE01132611262D5F00110E110F9A282100000A131011106B283200000A097B0A000004283300000A283400000A16FE01132611262D1C001104110F110D1C5911100E04283500000A6B5B283600000A002B14001104110F110D1C5922003C1CC6283600000A000000110F1758130F110F110E8E691759FE04132611263A78FFFFFF110D18FE0116FE01132611262D18110C723D0C007072B20100706F1E00000A283700000A1307110D19FE0116FE01132611262D18110C72530C007072B20100706F1E00000A283700000A1308110D1AFE0116FE01132611262D18110C72690C007072B20100706F1E00000A283700000A130911081109097B07000004282F00000A6C5A58130A110D1758130D00110B6F3800000A25130C14FE0116FE01132611263AB3FEFFFF110B6F3900000A0016131116131204282F00000A131405282F00000A131511071316110A131711071318110A1319097B08000004282F00000A131A097B07000004282F00000A131B22003C1CC6131C22003C1CC6131D380F040000001115111AFE0216FE01132611262D0600111A13150038AB030000001114111BFE0216FE01132611262D0600111B131400732200000A131E22003C1CC6131C22003C1CC6131D110A11126C11095A591316383001000000389400000000110411111112283A00000A131F111E121F283B00000A6F2400000A26111F111D3409111F22003C1CC6330E111D22003C1CC6FE0116FE012B0116132611262D04111F131D111F111C3609111F22003C1CC6330E111C22003C1CC6FE0116FE012B0116132611262D04111F131C111111151759FE0416FE01132611262D0F00111E72B80100706F2400000A26001111175813110011111115FE04132611263A5DFFFFFF111211141759FE0416FE01132611262D0F00111E72B40100706F2400000A2600110711116C11095A5813191115111AFE01132611262D0F00111105282F00000A591311002B2400111A283C00000A05283D00000A282F00000A6C283E00000A6905282F00000A5A131100110711116C11095A581317110A11126C11095A5913181112175813120011121114FE04132611263AC1FEFFFF73190000060B1116132011171321111813221119132311162300000000008056C0FE0416FE01132611262D11001116652300000000008066405913200011182300000000008056C0FE0416FE01132611262D1100111865230000000000806640591322001117230000000000806640FE0216FE01132611262D0E11172300000000008076405913211119230000000000806640FE0216FE01132611262D0E11192300000000008076405913231F158D040000011327112716727D0C0070A211271711218C2F000001A211271872B8010070A211271911208C2F000001A211271A72B4010070A211271B11218C2F000001A211271C72B8010070A211271D11228C2F000001A211271E72B4010070A211271F0911238C2F000001A211271F0A72B8010070A211271F0B11228C2F000001A211271F0C72B4010070A211271F0D11238C2F000001A211271F0E72B8010070A211271F0F11208C2F000001A211271F1072B4010070A211271F1111218C2F000001A211271F1272B8010070A211271F1311208C2F000001A211271F1472910C0070A21127283F00000A1313071113734000000A734100000A03282F00000A284200000A7D0C00000407111C734300000A7D0E00000407111D734300000A7D0F0000041202FE15020000021202720F000070280A00000600120211167D06000004120211177D050000041202111E6F2500000A280C0000060014131E120211096B28110000060007087D0D00000406076F4400000A26111404282F00000A581314001112111BFE04132611263A46FCFFFF1114111B320B1115111AFE0416FE012B0116132611262D1E0016131204282F00000A131411151311111505282F00000A581315002B03002B10001111111AFE04132611263AE2FBFFFF0613242B0011242A00133002001D0000000D00001100020328150000060A732E00000A0B07066F4400000A26070C2B00082A00000013300300CF0200000E0000110073180000060A160B160C2300000000000000000D2300000000000000001304230000000000000000130523000000008087C3C01306230000000000000000130723000000000000000013080F00FE16050000016F2500000A733100000A130A14130B16130C38FC00000000110C16FE0116FE01130E110E2D17110B72970C007072B20100706F1E00000A284500000A0C110C17FE0116FE01130E110E2D17110B72A50C007072B20100706F1E00000A284500000A0B110C18FE0116FE01130E110E2D17110B723D0C007072B20100706F1E00000A283700000A0D110C19FE0116FE01130E110E2D18110B72530C007072B20100706F1E00000A283700000A1304110C1AFE0116FE01130E110E2D18110B72690C007072B20100706F1E00000A283700000A1305110C1BFE0116FE01130E110E2D18110B72B30C007072B20100706F1E00000A283700000A130611041105076C5A581307091105086C5A581308110C1758130C00110A6F3800000A25130B2C07110C1CFE042B0116130E110E3AE7FEFFFF1F158D04000001130F110F16727D0C0070A2110F17098C2F000001A2110F1872B8010070A2110F1911078C2F000001A2110F1A72B4010070A2110F1B098C2F000001A2110F1C72B8010070A2110F1D11048C2F000001A2110F1E72B4010070A2110F1F0911088C2F000001A2110F1F0A72B8010070A2110F1F0B11048C2F000001A2110F1F0C72B4010070A2110F1F0D11088C2F000001A2110F1F0E72B8010070A2110F1F0F11078C2F000001A2110F1F1072B4010070A2110F1F11098C2F000001A2110F1F1272B8010070A2110F1F1311078C2F000001A2110F1F1472910C0070A2110F283F00000A13090607283C00000A7D070000040608283C00000A7D08000004061109734000000A734100000A03282F00000A284200000A7D0B000004061106734600000A7D0A000004061105734600000A7D09000004110A6F3900000A0006130D2B00110D2A0013300200430000000F000011000274040000020A04067B08000004810C00000103067B07000004810C00000105067B0A00000481090000010E04067B0900000481090000010E05067B0B000004512A1E02284700000A2A2A02284700000A0000002A2A02284700000A0000002A00000042534A4201000100000000000C00000076322E302E35303732370000000005006C00000048070000237E0000B4070000F807000023537472696E677300000000AC0F0000D00C0000235553007C1C00001000000023475549440000008C1C00007C05000023426C6F6200000000000000020000015717A2090902000000FA0133001600000100000033000000050000000F00000019000000200000000200000047000000130000000F0000000100000005000000080000000100000001000000030000000200000000000A0001000000000006005C0055000A00870072000A00AC0091000600BD0055000A00060172000A00100172000600C801BE010600DB01BE010A003D0272000E00610247020600960283020A00A20272000A00AB0272000A00610391000600AD038E0306005504430406006C0443040600890443040600A80443040600C10443040600DA0443040600F5044304060010054304060029058E0306003D058E0306004B0543040600640543040600940581057300A80500000600D705B7050600F705B7050600150655000A002B0691000A004706910006004E068E03060064068E030A006F06910006008C0655000600BE0655000600DC0655000600EF06E3060A002C07910006004107830206005707BE010600640755000A007507720006009A0755000600A107BE010600CB0755000A00D60772000600F20755000000000001000000000001000100092110001700000005000100010001001000200000001100070012000300100030000000110007001800030010003F00000011000C0019000100C4000A000100CC000D000100D4000D000100E20010000600EE0013000600F50013000600FF02B60006000C03B60006001C03BA0006002503BA0006003103BE0006003103BE0006003D03C20006004803BA0006005103BA00502000000000E609FB001600010068200000000096001B011A000100EC210000000096002801230003003C2300000000910038012A0004007C23000000009600460123000500CC2400000000960857012F000600F0240000000086006001340006006C2500000000C6006901340007009025000000008608720134000700C925000000008608830138000700D425000000008608940134000800EC25000000008608A60138000800F825000000009600B801230009002C2600000000E601D5013D000A007B2600000000E601E80143000B00BC26000000008608ED0149000C00D426000000008608FC014D000C00E0260000000096006E026C000D002427000000009600B4027D0012007C2D000000009600C1028C001700A82D000000009100D302950019008430000000009600DF029E001B00D330000000008618F902B2002100DB30000000008618F902B2002100E630000000008618F902B2002100000001005A03000002005C03000001005A03000001005E03000001005A03000000000000000001007303000001007303000001005A03000001007903000001007B03000001007303000001007D0302000200890302000300BA0302000400C70302000500D40300000100E00300000200F00300000300F40300000400FD0300000500060400000100E00300000200F00300000100E00300000200F003000001007D03020002001104020003001E04020004002E04020005003A0402000600D4030200090002000D007100F902B2007900F902B2008100F90238008900F90238009100F90238009900F9023800A100F9023800A900F9023800B100F9023800B900F9023800C100F902D900C900F9023800D100F9023800D900F9023800E100F902DE00F100F902E400F900F902B2000101F902B2000901F902E9001901F9023D012901F902B2002900FB00160029008206340031019306340031019806D9013101A406DE013101AA0634003101B206E5013901F90238003101C806EB013100D006F1014900820649004101B8011C024901F902B2003101FD0631024901040739022100690134000900690134003900D5014D003900D50138003900D501730241000B0749004100160734004100210778025101F902B2005901F902B20061004B073F030C00F9024D036101F902380049006907530349008007590371018E07630369004B076A030C00960770037901B80177038101AC0734008101B507B2000C00BB077C034101690134006100690782036100BF0788038901D00791033101FD0696032900F90238009101F9029C035100DF07A2034900F9024D005901EE07AB039901B801B7044900F90273022100F902B2002E003300ED042E008B005C052E004300F7042E00830053052E002300E7042E002B00E7042E003B00D9042E001B00D9042E004B00E7042E005B00E7042E00630013052E0073003D052E007B004A054000AB00480143009B00F000C4000B00C600A001AB00580260026B01850280026B01EE034401F6010B0221022A0240024C0250026B027C028002B003AD04BC04D4040200010000000B025200000012025600000017025B00000024025B00000032025F0002000100030002000600050001000A00070002000900070001000C00090002000B000900020010000B00010011000B0045030480000001000000000000000000000000001700000002000000000000000000000001004C000000000002000000000000000000000001006600000000000A0000000000000000000000630047020000000004000300050003000000003C4D6F64756C653E00436F7665726167652E646C6C00436F7665726167650052617374657246756E6374696F6E73005261737465724D65746164617461005261737465724F626A656374006D73636F726C69620053797374656D0056616C7565547970650053797374656D2E446174610053797374656D2E446174612E53716C547970657300494E756C6C61626C65004D6963726F736F66742E53716C5365727665722E536572766572004942696E61727953657269616C697A65004F626A6563740069735F4E756C6C005F76616C756573005F636F76657261676554797065005F7265736F6C7574696F6E00756C6C6F6E6700756C6C6174006765745F49734E756C6C0053716C537472696E670053716C446563696D616C004772696446726F6D546578740050726F66696C6546726F6D54657874005472795061727365466C6F6174005472616E7365637446726F6D54657874006765745F4E756C6C00535441735465787400546F537472696E67006765745F436F76657261676554797065007365745F436F76657261676554797065006765745F54657874436F6E7461696E6572007365745F54657874436F6E7461696E65720050617273650053797374656D2E494F0042696E6172795772697465720057726974650042696E6172795265616465720052656164006765745F5265736F6C7574696F6E007365745F5265736F6C7574696F6E0049734E756C6C004E756C6C00436F766572616765547970650054657874436F6E7461696E6572005265736F6C7574696F6E0053716C53696E676C65004D6963726F736F66742E53716C5365727665722E54797065730053716C47656F67726170687900496D706F72745261737465725F46696C6C526F770053797374656D2E436F6C6C656374696F6E730049456E756D657261626C650053716C496E7433320053716C496E74313600496D706F7274526173746572004765745261737465724D65746164617461004765744D65746164617461004765745261737465724D657461646174615F46696C6C526F77002E63746F72006E756D6265724F66526F7773006E756D6265724F66436F6C756D6E730063656C6C53697A65006E6F4461746156616C756500626F756E64696E67426F7800726173746572426F6479006D617856616C7565006D696E56616C75650073006B00666C0053716C46616365744174747269627574650076616C75650077007200726D526573756C744F626A00477269640053797374656D2E52756E74696D652E496E7465726F705365727669636573004F7574417474726962757465004D696E696D756D56616C7565004D6178696D756D56616C756500426F756E64696E67426F780066696C6550617468416E644E616D65005352530074696C65726F77730074696C65636F6C73006D756C7469706C696572004E756D6265724F66526F7773004E756D6265724F66436F6C756D6E73004E6F4461746156616C75650043656C6C53697A650053797374656D2E5265666C656374696F6E00417373656D626C795469746C6541747472696275746500417373656D626C794465736372697074696F6E41747472696275746500417373656D626C79436F6E66696775726174696F6E41747472696275746500417373656D626C79436F6D70616E7941747472696275746500417373656D626C7950726F6475637441747472696275746500417373656D626C79436F7079726967687441747472696275746500417373656D626C7954726164656D61726B41747472696275746500417373656D626C7943756C7475726541747472696275746500436F6D56697369626C65417474726962757465004775696441747472696275746500417373656D626C7956657273696F6E41747472696275746500417373656D626C7946696C6556657273696F6E4174747269627574650053797374656D2E446961676E6F73746963730044656275676761626C6541747472696275746500446562756767696E674D6F6465730053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300436F6D70696C6174696F6E52656C61786174696F6E734174747269627574650052756E74696D65436F6D7061746962696C6974794174747269627574650053657269616C697A61626C654174747269627574650053716C55736572446566696E65645479706541747472696275746500466F726D6174005374727563744C61796F7574417474726962757465004C61796F75744B696E640053716C4D6574686F64417474726962757465006765745F56616C756500537472696E67005472696D00546F4368617241727261790053706C697400546F4C6F776572006F705F457175616C69747900457863657074696F6E005265706C61636500546F53716C53696E676C650053696E676C650053797374656D2E5465787400537472696E674275696C64657200436F6E63617400417070656E64005265616453696E676C650052656164537472696E670052656164446F75626C650053716C46756E6374696F6E4174747269627574650041727261794C697374006F705F4578706C696369740053747265616D5265616465720043686172006F705F496D706C696369740053716C426F6F6C65616E006F705F496E657175616C697479006F705F547275650053657400446F75626C65005465787452656164657200526561644C696E6500436C6F736500476574006F705F4469766973696F6E004D61746800466C6F6F720053716C436861727300535447656F6D46726F6D546578740041646400496E7433320000032800000967007200690064000009470052004900440000819343006F007600650072006100670065002000740079007000650020006500720072006F0072002E00200047005200490044002000740079007000650020006D0075007300740020006200650020007500730065006400200066006F0072002000740068006900730020006F007000650072006100740069006F006E002E002000560061006C0069006400200066006F0072006D00610074003A0020004700720069006400460072006F006D005400650078007400280027004700520049004400280072006F00770031002D0063006F006C0075006D006E003100200072006F00770031002D0063006F006C0075006D006E0032002E002E002E002E0072006F00770031002D0063006F006C0075006D006E004E002C00200072006F00770032002D0063006F006C0075006D006E003100200072006F00770032002D0063006F006C0075006D006E0032002E002E002E0072006F00770032002D0063006F006C0075006D006E004E00290027002C007200650073006F006C007500740069006F006E005F006D0065007400650072007300290001032900000100032C00000320000053470052004900440073002000630061006E0020006E006F007400200063006F006E007400610069006E0020006E006F006E002D006E0075006D0065007200690063002000760061006C007500650073002E000181474500610063006800200072006F007700200069006E002000740068006500200067007200690064002000730068006F0075006C0064002000680061007600650020007400680065002000730061006D00650020006E0075006D0062006500720020006F006600200063006F006C0075006D006E0073002E002000550073006500200061002000660069006C006C00650072002000760061006C007500650020006F00660020002D003900390039003900200066006F007200200062006C0061006E006B002000630065006C006C007300200074006F00200069006E0064006900630061007400650020007400680065002000630065006C006C00730020007400680061007400200061007200650020006E006F00740020007100750061006E0074006900660069006500640020006F00720020007200650070006F0072007400650064002E00010F700072006F00660069006C006500000F500052004F00460049004C00450000813143006F007600650072006100670065002000740079007000650020006500720072006F0072002E002000500052004F00460049004C0045002000740079007000650020006D0075007300740020006200650020007500730065006400200066006F0072002000740068006900730020006F007000650072006100740069006F006E002E002000560061006C0069006400200066006F0072006D00610074003A002000500072006F00660069006C006500460072006F006D00540065007800740028002700500052004F00460049004C00450028006400650070007400680031002000760061006C007500650031002C0020006400650070007400680032002000760061006C007500650032002C0020006400650070007400680033002000760061006C0075006500330029002700290001819D530079006E0074006100780020006500720072006F0072002E002000500052004F00460049004C00450073002000630061006E0020006E006F007400200063006F006E007400610069006E0020006E006F006E002D006E0075006D0065007200690063002000760061006C007500650073002E002000560061006C0069006400200066006F0072006D00610074003A002000500072006F00660069006C006500460072006F006D00540065007800740028002700500052004F00460049004C00450028006400650070007400680031002000760061006C007500650031002C0020006400650070007400680032002000760061006C007500650032002C0020006400650070007400680033002000760061006C00750065003300290027002900200077006800650072006500200062006F00740068002000760061006C0075006500200061006E00640020006400650070007400680020006E006500650064007300200074006F0020006200650020006F0066002000610020006E0075006D00650072006900630020006400610074006100200074007900700065000181CD530079006E0074006100780020006500720072006F0072002E002000500052004F00460049004C00450020006D0065006D0062006500720073002000730068006F0075006C006400200063006F006E00730069007300740020006F006600200064006500700074006800200061006E0064002000760061006C00750065002000700061006900720073002000730065007000610072006100740065006400200062007900200061002000730069006E0067006C0065002000730070006100630065002E002000450061006300680020006D0065006D006200650072002000730068006F0075006C00640020006200650020007300650070006100720061007400650064002000770069007400680020006100200063006F006D006D0061002E002000560061006C0069006400200066006F0072006D00610074003A002000500072006F00660069006C006500460072006F006D00540065007800740028002700500052004F00460049004C00450028006400650070007400680031002000760061006C007500650031002C0020006400650070007400680032002000760061006C007500650032002C0020006400650070007400680033002000760061006C0075006500330029002700290001117400720061006E00730065006300740000115400520041004E00530045004300540000810343006F007600650072006100670065002000740079007000650020006500720072006F0072002E0020005400520041004E0053004500430054002000740079007000650020006D0075007300740020006200650020007500730065006400200066006F0072002000740068006900730020006F007000650072006100740069006F006E002E002000560061006C0069006400200066006F0072006D00610074003A0020005400720061006E007300650063007400460072006F006D005400650078007400280027005400520041004E0053004500430054002800780031002000790031002C00780032002000790032002C007800330020007900330029002700290001815D530079006E0074006100780020006500720072006F0072002E0020005400520041004E00530045004300540073002000630061006E0020006E006F007400200063006F006E007400610069006E0020006E006F006E002D006E0075006D0065007200690063002000760061006C007500650073002E002000560061006C0069006400200066006F0072006D00610074003A0020005400720061006E007300650063007400460072006F006D005400650078007400280027005400520041004E0053004500430054002800780031002000790031002C00780032002000790032002C0078003300200079003300290027002900200077006800650072006500200062006F007400680020007800200061006E0064002000790020006E00650065006400200074006F0020006200650020006F0066002000610020006E0075006D006500720069006300200064006100740061002000740079007000650001818F530079006E0074006100780020006500720072006F0072002E0020005400520041004E00530045004300540020006D0065006D0062006500720073002000730068006F0075006C006400200063006F006E00730069007300740020006F00660020007800200061006E006400200079002000700061006900720073002000730065007000610072006100740065006400200062007900200061002000730069006E0067006C0065002000730070006100630065002E002000450061006300680020006D0065006D006200650072002000730068006F0075006C00640020006200650020007300650070006100720061007400650064002000770069007400680020006100200063006F006D006D0061002E002000560061006C0069006400200066006F0072006D00610074003A0020005400720061006E007300650063007400460072006F006D005400650078007400280027005400520041004E0053004500430054002800780031002000790031002C00780032002000790032002C007800330020007900330029002700290001094E0055004C004C00001578006C006C0063006F0072006E00650072002000001579006C006C0063006F0072006E006500720020000013630065006C006C00730069007A0065002000001350004F004C00590047004F004E0028002800000529002900000D6E0063006F006C0073002000000D6E0072006F00770073002000001B4E004F0044004100540041005F00760061006C007500650020000000A5D687D72B496E49A021E9BF08764E9A0008B77A5C561934E08902060202060E02060C02060D0320000208000211081115111906000111081115040001020E04000011080320000E042001010E05200101121D0520010112210320000C042001010C0328000204080011080328000E0328000C0889845DCD8080CC91100005011C1011081011251011251012290E0005122D11151131113111311135080002122D11151131080002121011151131130006011C101131101131101125101125101229032000010306113103061125030612290306110812010001005408074D617853697A65FFFFFFFF04200101020520010111750420010108062001011180894C010002000000040054020D4973427974654F7264657265640154080B4D61784279746553697A65FFFFFFFF54020D497346697865644C656E67746800540E044E616D6508436F7665726167650620010111809103070102808F010001005455794D6963726F736F66742E53716C5365727665722E5365727665722E446174614163636573734B696E642C2053797374656D2E446174612C2056657273696F6E3D322E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390A44617461416363657373010000000420001D030620011D0E1D03050002020E0E0520020E0E0E042000112514070C11080E1D0E0E1D0E08081D0E08110802112510070911080E1D0E0E1D0E081D0E1108020400010C0E0807040C0212809D02060702110811080700040E0E0E0E0E0620011280A50E0B07051D0E1280A50E1D0E020307010E0707031D0E0E1D0E120100010054020A4F6E4E756C6C43616C6C000707031108110802042001010D0320000D0307010C040701121480B8010002005455794D6963726F736F66742E53716C5365727665722E5365727665722E446174614163636573734B696E642C2053797374656D2E446174612C2056657273696F6E3D322E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390A4461746141636365737301000000540E1146696C6C526F774D6574686F644E616D6514496D706F72745261737465725F46696C6C526F7705000108113107140C020002000005200201080805000111250C0900021180B911251125060001021180B90500010611350620030108080C0400010D0E0520020C08080500011131080800021131113111310400010D0D0500010E1D1C05200101111508000212291280C908042001081C3D07281280AD121411081210140C020002000008080D0D0D0D1280B10E081D0E080C08080E08080D0D0D0D08080C0C1280A50C0D0D0D0D122D1D03021D1C80BD010002005455794D6963726F736F66742E53716C5365727665722E5365727665722E446174614163636573734B696E642C2053797374656D2E446174612C2056657273696F6E3D322E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390A4461746141636365737301000000540E1146696C6C526F774D6574686F644E616D65194765745261737465724D657461646174615F46696C6C526F7709070312101280AD122D040001080E170710121008080D0D0D0D0D0D0E1280B10E081210021D1C04070112100D010008436F7665726167650000050100000000090100044D53495400001B010016436F7079726967687420C2A9204D534954203230303800002901002437323331393566382D656638382D343731382D626532352D38396264633232623431643800000C010007312E302E302E3000000801000701000000000801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F77730100000000000312E3490000000002000000770000001853000018350000525344538E2387CA96E5CC44B50495365B9124AD04000000433A5C55736572735C626F726162655C446F63756D656E74735C56697375616C2053747564696F20323030385C50726F6A656374735C436F7665726167655C436F7665726167655C6F626A5C44656275675C436F7665726167652E7064620000B85300000000000000000000CE530000002000000000000000000000000000000000000000000000C05300000000000000005F436F72446C6C4D61696E006D73636F7265652E646C6C0000000000FF25002040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100100000001800008000000000000000000000000000000100010000003000008000000000000000000000000000000100000000004800000058600000E40200000000000000000000E40234000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE00000100000001000000000000000100000000003F000000000000000400000002000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B00444020000010053007400720069006E006700460069006C00650049006E0066006F0000002002000001003000300030003000300034006200300000002C000500010043006F006D00700061006E0079004E0061006D006500000000004D00530049005400000000003C0009000100460069006C0065004400650073006300720069007000740069006F006E000000000043006F0076006500720061006700650000000000300008000100460069006C006500560065007200730069006F006E000000000031002E0030002E0030002E00300000003C000D00010049006E007400650072006E0061006C004E0061006D006500000043006F007600650072006100670065002E0064006C006C00000000005000160001004C006500670061006C0043006F007000790072006900670068007400000043006F0070007900720069006700680074002000A90020004D0053004900540020003200300030003800000044000D0001004F0072006900670069006E0061006C00460069006C0065006E0061006D006500000043006F007600650072006100670065002E0064006C006C0000000000340009000100500072006F0064007500630074004E0061006D0065000000000043006F0076006500720061006700650000000000340008000100500072006F006400750063007400560065007200730069006F006E00000031002E0030002E0030002E003000000038000800010041007300730065006D0062006C0079002000560065007200730069006F006E00000031002E0030002E0030002E003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000C000000E03300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    WITH PERMISSION_SET = EXTERNAL_ACCESS;


GO
PRINT N'Creating dbo.Coverage...';


GO
CREATE TYPE [dbo].[Coverage]
     EXTERNAL NAME [MSR.SpatialData].[Coverage];


GO
PRINT N'Creating ODCollections.ObservationGroup...';


GO
CREATE TABLE [ODCollections].[ObservationGroup] (
    [SeriesSetID] INT      NOT NULL,
    [SeriesID]    INT      NOT NULL,
    [CreatedBy]   INT      NOT NULL,
    [TimeStamp]   DATETIME NOT NULL
);


GO
PRINT N'Creating ODCollections.SeriesSet...';


GO
CREATE TABLE [ODCollections].[SeriesSet] (
    [SeriesSetID]       INT           IDENTITY (1, 1) NOT NULL,
    [SeriesSetName]     VARCHAR (150) NOT NULL,
    [Description]       VARCHAR (550) NULL,
    [CategoryID]        INT           NOT NULL,
    [CreatedByID]       INT           NOT NULL,
    [DateCreated]       DATETIME      NOT NULL,
    [DateFinalized]     DATETIME      NULL,
    [DateRetired]       DATETIME      NULL,
    [AccessibilityRole] VARCHAR (20)  NOT NULL
);


GO
PRINT N'Creating ODCore.ControlledVocabulary...';


GO
CREATE TABLE [ODCore].[ControlledVocabulary] (
    [TermID]         INT           IDENTITY (1, 1) NOT NULL,
    [Term]           VARCHAR (50)  NOT NULL,
    [TermDefinition] VARCHAR (100) NULL
);


GO
PRINT N'Creating ODCore.DataQuality...';


GO
CREATE TABLE [ODCore].[DataQuality] (
    [DataQualityID]      INT           IDENTITY (1, 1) NOT NULL,
    [Description]        VARCHAR (250) NOT NULL,
    [QCRating]           REAL          NOT NULL,
    [QCResultID]         INT           NOT NULL,
    [ResponsiblePartyID] INT           NOT NULL,
    [DateCreated]        DATETIME      NOT NULL
);


GO
PRINT N'Creating ODCore.Feature...';


GO
CREATE TABLE [ODCore].[Feature] (
    [FeatureID]      INT                 IDENTITY (1, 1) NOT NULL,
    [HierarchyCode]  [sys].[hierarchyid] NOT NULL,
    [HierarchyLevel] AS                  ([HierarchyCode].[GetLevel]()),
    [FeatureName]    VARCHAR (200)       NULL,
    [FeatureTypeID]  INT                 NOT NULL,
    [GeoPosition]    [sys].[geography]   NOT NULL
);


GO
PRINT N'Creating ODCore.Method...';


GO
CREATE TABLE [ODCore].[Method] (
    [MethodID]          INT            IDENTITY (1, 1) NOT NULL,
    [MethodName]        VARCHAR (100)  NOT NULL,
    [MethodDescription] VARCHAR (1500) NULL
);


GO
PRINT N'Creating ODCore.ObservedVariable...';


GO
CREATE TABLE [ODCore].[ObservedVariable] (
    [VariableID]          INT           IDENTITY (1, 1) NOT NULL,
    [VariableCodeID]      INT           NOT NULL,
    [VariableName]        VARCHAR (150) NOT NULL,
    [VariableDefinition]  VARCHAR (350) NULL,
    [ObservationMediumID] INT           NOT NULL,
    [SourceID]            INT           NOT NULL,
    [DateCreated]         DATETIME      NULL
);


GO
PRINT N'Creating ODCore.ResponsibleParty...';


GO
CREATE TABLE [ODCore].[ResponsibleParty] (
    [SourceID]          INT           IDENTITY (1, 1) NOT NULL,
    [SourceGroup]       INT           NOT NULL,
    [SourceCode]        VARCHAR (50)  NOT NULL,
    [SourceName]        VARCHAR (250) NOT NULL,
    [SourceDescription] VARCHAR (350) NULL,
    [SourceRole]        VARCHAR (50)  NOT NULL,
    [ContactName]       VARCHAR (50)  NULL,
    [ContactEmail]      VARCHAR (50)  NULL,
    [ContactPhone]      VARCHAR (50)  NULL
);


GO
PRINT N'Creating ODCore.SeriesAnnotation...';


GO
CREATE TABLE [ODCore].[SeriesAnnotation] (
    [SeriesID]      INT           NOT NULL,
    [Title]         VARCHAR (50)  NOT NULL,
    [Note]          VARCHAR (550) NOT NULL,
    [TimeStamp]     DATETIME      NOT NULL,
    [AnnotatedByID] INT           NOT NULL
);


GO
PRINT N'Creating ODCore.SeriesCatalog...';


GO
CREATE TABLE [ODCore].[SeriesCatalog] (
    [SeriesID]                    INT      IDENTITY (1, 1) NOT NULL,
    [FeatureID]                   INT      NOT NULL,
    [VariableID]                  INT      NOT NULL,
    [MethodID]                    INT      NOT NULL,
    [ObservationTypeID]           INT      NOT NULL,
    [IsCategorical]               BIT      NOT NULL,
    [SpatialRepresentationTypeID] INT      NOT NULL,
    [TimeSupportID]               INT      NOT NULL,
    [UnitID]                      INT      NOT NULL,
    [BeginDateTime]               DATETIME NOT NULL,
    [EndDateTime]                 DATETIME NOT NULL,
    [ObservationCount]            INT      NOT NULL,
    [OverallQualityIndicatorID]   INT      NOT NULL,
    [DateCreated]                 DATETIME NOT NULL,
    [DateModified]                DATETIME NOT NULL,
    [DateFinalized]               DATETIME NULL,
    [UpdateFrequency]             INT      NULL,
    [UpdateFrequencyUnit]         INT      NULL,
    [OriginatorID]                INT      NOT NULL
);


GO
PRINT N'Creating ODCore.TermTableMapping...';


GO
CREATE TABLE [ODCore].[TermTableMapping] (
    [TermID]             INT           NOT NULL,
    [AttributeReference] VARCHAR (150) NOT NULL
);


GO
PRINT N'Creating ODCore.TimeSupport...';


GO
CREATE TABLE [ODCore].[TimeSupport] (
    [TimeSupportID]        INT           IDENTITY (1, 1) NOT NULL,
    [IntervalLength]       REAL          NOT NULL,
    [IntervalLengthUnitID] INT           NOT NULL,
    [Spacing]              REAL          NOT NULL,
    [SpacingUnitID]        INT           NOT NULL,
    [DataTypeID]           INT           NOT NULL,
    [Description]          VARCHAR (150) NULL,
    [ReportingPrecisionID] INT           NOT NULL
);


GO
PRINT N'Creating ODCore.Unit...';


GO
CREATE TABLE [ODCore].[Unit] (
    [UnitID]           INT           IDENTITY (1, 1) NOT NULL,
    [UnitTypeID]       INT           NOT NULL,
    [UnitAbbreviation] VARCHAR (50)  NOT NULL,
    [UnitDescription]  VARCHAR (250) NOT NULL
);


GO
PRINT N'Creating ODCore.UpdateLogs...';


GO
CREATE TABLE [ODCore].[UpdateLogs] (
    [UpdateType]     VARCHAR (50)   NOT NULL,
    [Description]    VARCHAR (2500) NOT NULL,
    [IndividualName] VARCHAR (150)  NOT NULL,
    [TimeStamp]      DATETIME       NOT NULL
);


GO
PRINT N'Creating ODData.ClassificationScheme...';


GO
CREATE TABLE [ODData].[ClassificationScheme] (
    [SchemaID]    INT           NOT NULL,
    [SchemaName]  VARCHAR (150) NOT NULL,
    [CreatedByID] INT           NOT NULL
);


GO
PRINT N'Creating ODData.Coverage...';


GO
CREATE TABLE [ODData].[Coverage] (
    [ObjectID]          INT               IDENTITY (1, 1) NOT NULL,
    [SeriesID]          INT               NOT NULL,
    [LocalDateTime]     DATETIME          NOT NULL,
    [UTCOffsetHours]    REAL              NOT NULL,
    [ObservationValues] [dbo].[Coverage]  NOT NULL,
    [CoverageGeometry]  [sys].[geography] NOT NULL
);


GO
PRINT N'Creating ODData.LaboratoryAnalysis...';


GO
CREATE TABLE [ODData].[LaboratoryAnalysis] (
    [AnalysisID]       INT      IDENTITY (1, 1) NOT NULL,
    [ValueID]          INT      NULL,
    [SampleID]         INT      NOT NULL,
    [LaboratoryID]     INT      NOT NULL,
    [AnalysisDateTime] DATETIME NOT NULL
);


GO
PRINT N'Creating ODData.ObservedCategory...';


GO
CREATE TABLE [ODData].[ObservedCategory] (
    [CategoryID]             INT                 IDENTITY (1, 1) NOT NULL,
    [HierarchyCode]          [sys].[hierarchyid] NOT NULL,
    [HierarchyLevel]         AS                  ([HierarchyCode].[GetLevel]()),
    [CategoryCode]           VARCHAR (50)        NOT NULL,
    [CategoryDescription]    VARCHAR (500)       NOT NULL,
    [ClassificationSchemeID] INT                 NOT NULL
);


GO
PRINT N'Creating ODData.Provenance...';


GO
CREATE TABLE [ODData].[Provenance] (
    [ProcessStep]        INT           NOT NULL,
    [OutputSeriesID]     INT           NOT NULL,
    [InputSeriesID]      INT           NOT NULL,
    [MethodID]           INT           NOT NULL,
    [Rationale]          VARCHAR (250) NULL,
    [ResponsiblePartyID] INT           NOT NULL,
    [ProcessingDateTime] DATETIME      NOT NULL
);


GO
PRINT N'Creating ODData.Sample...';


GO
CREATE TABLE [ODData].[Sample] (
    [SampleID]             INT           IDENTITY (1, 1) NOT NULL,
    [SampleCode]           VARCHAR (150) NULL,
    [SampleQuantity]       REAL          NOT NULL,
    [SampleQuantityUnitID] INT           NOT NULL,
    [SampleTypeID]         INT           NOT NULL,
    [CollectionMethodText] VARCHAR (550) NULL,
    [PreservationMethodID] INT           NOT NULL
);


GO
PRINT N'Creating ODData.TimeSeries...';


GO
CREATE TABLE [ODData].[TimeSeries] (
    [ObservationID]        INT      IDENTITY (1, 1) NOT NULL,
    [SeriesID]             INT      NOT NULL,
    [LocalDateTime]        DATETIME NOT NULL,
    [UTCOffsetHours]       REAL     NOT NULL,
    [ObservedValue]        REAL     NOT NULL,
    [VerticalOffset]       REAL     NOT NULL,
    [VerticalOffsetUnitID] INT      NOT NULL,
    [VerticalReferenceID]  INT      NOT NULL,
    [ObservedCategoryID]   INT      NOT NULL,
    [CensorID]             INT      NOT NULL,
    [QualityIndicatorID]   INT      NOT NULL
);


GO
PRINT N'Creating ODExtensibility.FeatureProperty...';


GO
CREATE TABLE [ODExtensibility].[FeatureProperty] (
    [FeatureID]      INT                 NOT NULL,
    [PropertyID]     INT                 NOT NULL,
    [HierarchyCode]  [sys].[hierarchyid] NOT NULL,
    [HierarchyLevel] AS                  ([HierarchyCode].[GetLevel]()),
    [PropertyValue]  VARCHAR (550)       NOT NULL,
    [PropertyUnitID] INT                 NOT NULL,
    [TimeStamp]      DATETIME            NOT NULL
);


GO
PRINT N'Creating ODExtensibility.GenericProperty...';


GO
CREATE TABLE [ODExtensibility].[GenericProperty] (
    [PropertyID]          INT           IDENTITY (1, 1) NOT NULL,
    [PropertyName]        VARCHAR (50)  NOT NULL,
    [PropertyDescription] VARCHAR (500) NULL,
    [PropertyScope]       VARCHAR (50)  NOT NULL,
    [PropertyDataType]    VARCHAR (50)  NOT NULL,
    [CreatedByID]         INT           NOT NULL,
    [DateCreated]         DATETIME      NOT NULL
);


GO
PRINT N'Creating ODExtensibility.MethodProperty...';


GO
CREATE TABLE [ODExtensibility].[MethodProperty] (
    [MethodID]       INT                 NOT NULL,
    [PropertyID]     INT                 NOT NULL,
    [HierarchyCode]  [sys].[hierarchyid] NOT NULL,
    [HierarchyLevel] AS                  ([HierarchyCode].[GetLevel]()),
    [PropertyValue]  VARCHAR (550)       NOT NULL,
    [PropertyUnitID] INT                 NOT NULL,
    [TimeStamp]      DATETIME            NOT NULL
);


GO
PRINT N'Creating ODTranslation.Dictionary...';


GO
CREATE TABLE [ODTranslation].[Dictionary] (
    [NativeTerm]         VARCHAR (250) NOT NULL,
    [NativeVocabularyID] INT           NOT NULL,
    [LocalTermID]        INT           NOT NULL,
    [DateCreated]        DATETIME      NOT NULL
);


GO
PRINT N'Creating ODTranslation.NativeVocabulary...';


GO
CREATE TABLE [ODTranslation].[NativeVocabulary] (
    [VocabularyID]      INT           IDENTITY (1, 1) NOT NULL,
    [PublisherID]       INT           NOT NULL,
    [DownloadedFromURL] VARCHAR (350) NULL,
    [DateDownloaded]    DATETIME      NULL,
    [VocabularyText]    TEXT          NULL,
    [VocabularyType]    VARCHAR (50)  NOT NULL
);


GO
PRINT N'Creating ODCollections.PK_ODCollections_SeriesSet...';


GO
ALTER TABLE [ODCollections].[SeriesSet]
    ADD CONSTRAINT [PK_ODCollections_SeriesSet] PRIMARY KEY CLUSTERED ([SeriesSetID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_ControlledVocabulary...';


GO
ALTER TABLE [ODCore].[ControlledVocabulary]
    ADD CONSTRAINT [PK_ODCore_ControlledVocabulary] PRIMARY KEY CLUSTERED ([TermID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_DataQuality...';


GO
ALTER TABLE [ODCore].[DataQuality]
    ADD CONSTRAINT [PK_ODCore_DataQuality] PRIMARY KEY CLUSTERED ([DataQualityID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_Feature...';


GO
ALTER TABLE [ODCore].[Feature]
    ADD CONSTRAINT [PK_ODCore_Feature] PRIMARY KEY CLUSTERED ([FeatureID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_Method...';


GO
ALTER TABLE [ODCore].[Method]
    ADD CONSTRAINT [PK_ODCore_Method] PRIMARY KEY CLUSTERED ([MethodID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_ObservedVariable...';


GO
ALTER TABLE [ODCore].[ObservedVariable]
    ADD CONSTRAINT [PK_ODCore_ObservedVariable] PRIMARY KEY CLUSTERED ([VariableID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_ResponsibleParty...';


GO
ALTER TABLE [ODCore].[ResponsibleParty]
    ADD CONSTRAINT [PK_ODCore_ResponsibleParty] PRIMARY KEY CLUSTERED ([SourceID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_SeriesCatalog...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [PK_ODCore_SeriesCatalog] PRIMARY KEY CLUSTERED ([SeriesID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_TimeSupport...';


GO
ALTER TABLE [ODCore].[TimeSupport]
    ADD CONSTRAINT [PK_ODCore_TimeSupport] PRIMARY KEY CLUSTERED ([TimeSupportID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCore.PK_ODCore_Unit...';


GO
ALTER TABLE [ODCore].[Unit]
    ADD CONSTRAINT [PK_ODCore_Unit] PRIMARY KEY CLUSTERED ([UnitID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_ClassificationScheme...';


GO
ALTER TABLE [ODData].[ClassificationScheme]
    ADD CONSTRAINT [PK_ODData_ClassificationScheme] PRIMARY KEY CLUSTERED ([SchemaID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_Coverage...';


GO
ALTER TABLE [ODData].[Coverage]
    ADD CONSTRAINT [PK_ODData_Coverage] PRIMARY KEY CLUSTERED ([ObjectID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_LaboratoryAnalysis...';


GO
ALTER TABLE [ODData].[LaboratoryAnalysis]
    ADD CONSTRAINT [PK_ODData_LaboratoryAnalysis] PRIMARY KEY CLUSTERED ([AnalysisID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_ObservedCategory...';


GO
ALTER TABLE [ODData].[ObservedCategory]
    ADD CONSTRAINT [PK_ODData_ObservedCategory] PRIMARY KEY CLUSTERED ([CategoryID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_Sample...';


GO
ALTER TABLE [ODData].[Sample]
    ADD CONSTRAINT [PK_ODData_Sample] PRIMARY KEY CLUSTERED ([SampleID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODData.PK_ODData_TimeSeries...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [PK_ODData_TimeSeries] PRIMARY KEY CLUSTERED ([ObservationID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODExtensibility.PK_ODExtensibility_GenericProperty...';


GO
ALTER TABLE [ODExtensibility].[GenericProperty]
    ADD CONSTRAINT [PK_ODExtensibility_GenericProperty] PRIMARY KEY CLUSTERED ([PropertyID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODTranslation.PK_ODTranslation_NativeVocabulary...';


GO
ALTER TABLE [ODTranslation].[NativeVocabulary]
    ADD CONSTRAINT [PK_ODTranslation_NativeVocabulary] PRIMARY KEY CLUSTERED ([VocabularyID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);


GO
PRINT N'Creating ODCollections.FK_ODCollections_ObservationGroup_ODCollections_SeriesSet_SeriesSetID...';


GO
ALTER TABLE [ODCollections].[ObservationGroup]
    ADD CONSTRAINT [FK_ODCollections_ObservationGroup_ODCollections_SeriesSet_SeriesSetID] FOREIGN KEY ([SeriesSetID]) REFERENCES [ODCollections].[SeriesSet] ([SeriesSetID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCollections.FK_ODCollections_ObservationGroup_ODCore_ResponsibleParty_CreatedBy...';


GO
ALTER TABLE [ODCollections].[ObservationGroup]
    ADD CONSTRAINT [FK_ODCollections_ObservationGroup_ODCore_ResponsibleParty_CreatedBy] FOREIGN KEY ([CreatedBy]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCollections.FK_ODCollections_ObservationGroup_ODCore_SeriesCatalog_SeriesID...';


GO
ALTER TABLE [ODCollections].[ObservationGroup]
    ADD CONSTRAINT [FK_ODCollections_ObservationGroup_ODCore_SeriesCatalog_SeriesID] FOREIGN KEY ([SeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCollections.FK_ODCollections_SeriesSet_ODCore_ControlledVocabulary_CategoryID...';


GO
ALTER TABLE [ODCollections].[SeriesSet]
    ADD CONSTRAINT [FK_ODCollections_SeriesSet_ODCore_ControlledVocabulary_CategoryID] FOREIGN KEY ([CategoryID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCollections.FK_ODCollections_SeriesSet_ODCore_ResponsibleParty_CreatedByID...';


GO
ALTER TABLE [ODCollections].[SeriesSet]
    ADD CONSTRAINT [FK_ODCollections_SeriesSet_ODCore_ResponsibleParty_CreatedByID] FOREIGN KEY ([CreatedByID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_DataQuality_ODCore_ControlledVocabularies_QCResultID...';


GO
ALTER TABLE [ODCore].[DataQuality]
    ADD CONSTRAINT [FK_ODCore_DataQuality_ODCore_ControlledVocabularies_QCResultID] FOREIGN KEY ([QCResultID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_DataQuality_ODCore_ResponsibleParty_ResponsiblePartyID...';


GO
ALTER TABLE [ODCore].[DataQuality]
    ADD CONSTRAINT [FK_ODCore_DataQuality_ODCore_ResponsibleParty_ResponsiblePartyID] FOREIGN KEY ([ResponsiblePartyID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_Feature_ODCore_ControlledVocabularies_FeatureTypeID...';


GO
ALTER TABLE [ODCore].[Feature]
    ADD CONSTRAINT [FK_ODCore_Feature_ODCore_ControlledVocabularies_FeatureTypeID] FOREIGN KEY ([FeatureTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_ObservedVariable_ODCore_ControlledVocabularies_ObservationMediumID...';


GO
ALTER TABLE [ODCore].[ObservedVariable]
    ADD CONSTRAINT [FK_ODCore_ObservedVariable_ODCore_ControlledVocabularies_ObservationMediumID] FOREIGN KEY ([ObservationMediumID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_ObservedVariable_ODCore_ControlledVocabularies_VariableCodeID...';


GO
ALTER TABLE [ODCore].[ObservedVariable]
    ADD CONSTRAINT [FK_ODCore_ObservedVariable_ODCore_ControlledVocabularies_VariableCodeID] FOREIGN KEY ([VariableCodeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_ObservedVariable_ODCore_ResponsibleParty_SourceID...';


GO
ALTER TABLE [ODCore].[ObservedVariable]
    ADD CONSTRAINT [FK_ODCore_ObservedVariable_ODCore_ResponsibleParty_SourceID] FOREIGN KEY ([SourceID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesAnnotation_ODCore_ResponsibleParty_AnnotatedByID...';


GO
ALTER TABLE [ODCore].[SeriesAnnotation]
    ADD CONSTRAINT [FK_ODCore_SeriesAnnotation_ODCore_ResponsibleParty_AnnotatedByID] FOREIGN KEY ([AnnotatedByID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesAnnotation_ODCore_SeriesCatalog_SeriesID...';


GO
ALTER TABLE [ODCore].[SeriesAnnotation]
    ADD CONSTRAINT [FK_ODCore_SeriesAnnotation_ODCore_SeriesCatalog_SeriesID] FOREIGN KEY ([SeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_ControlledVocabularies_ObservationTypeID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_ControlledVocabularies_ObservationTypeID] FOREIGN KEY ([ObservationTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_ControlledVocabularies_SpatialRepresentationTypeID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_ControlledVocabularies_SpatialRepresentationTypeID] FOREIGN KEY ([SpatialRepresentationTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_DataQuality_OverallQualityIndicatorID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_DataQuality_OverallQualityIndicatorID] FOREIGN KEY ([OverallQualityIndicatorID]) REFERENCES [ODCore].[DataQuality] ([DataQualityID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_Feature_FeatureID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_Feature_FeatureID] FOREIGN KEY ([FeatureID]) REFERENCES [ODCore].[Feature] ([FeatureID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_Method_MethodID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_Method_MethodID] FOREIGN KEY ([MethodID]) REFERENCES [ODCore].[Method] ([MethodID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_ObservedVariable_VariableID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_ObservedVariable_VariableID] FOREIGN KEY ([VariableID]) REFERENCES [ODCore].[ObservedVariable] ([VariableID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_ResponsibleParty_PublisherID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_ResponsibleParty_PublisherID] FOREIGN KEY ([OriginatorID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_TimeSupport_TimeSupportID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_TimeSupport_TimeSupportID] FOREIGN KEY ([TimeSupportID]) REFERENCES [ODCore].[TimeSupport] ([TimeSupportID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_Unit_UnitID...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_Unit_UnitID] FOREIGN KEY ([UnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_SeriesCatalog_ODCore_Unit_UpdateFrequencyUnit...';


GO
ALTER TABLE [ODCore].[SeriesCatalog]
    ADD CONSTRAINT [FK_ODCore_SeriesCatalog_ODCore_Unit_UpdateFrequencyUnit] FOREIGN KEY ([UpdateFrequencyUnit]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_TermTableMappings_ODCore_ControlledVocabularies_TermID...';


GO
ALTER TABLE [ODCore].[TermTableMapping]
    ADD CONSTRAINT [FK_ODCore_TermTableMappings_ODCore_ControlledVocabularies_TermID] FOREIGN KEY ([TermID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_TimeSupport_ODCore_ControlledVocabularies_DataTypeID...';


GO
ALTER TABLE [ODCore].[TimeSupport]
    ADD CONSTRAINT [FK_ODCore_TimeSupport_ODCore_ControlledVocabularies_DataTypeID] FOREIGN KEY ([DataTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_TimeSupport_ODCore_ControlledVocabularies_ReportingPrecisionID...';


GO
ALTER TABLE [ODCore].[TimeSupport]
    ADD CONSTRAINT [FK_ODCore_TimeSupport_ODCore_ControlledVocabularies_ReportingPrecisionID] FOREIGN KEY ([ReportingPrecisionID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_TimeSupport_ODCore_Unit_IntervalLengthUnitID...';


GO
ALTER TABLE [ODCore].[TimeSupport]
    ADD CONSTRAINT [FK_ODCore_TimeSupport_ODCore_Unit_IntervalLengthUnitID] FOREIGN KEY ([IntervalLengthUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_TimeSupport_ODCore_Unit_SpacingUnitID...';


GO
ALTER TABLE [ODCore].[TimeSupport]
    ADD CONSTRAINT [FK_ODCore_TimeSupport_ODCore_Unit_SpacingUnitID] FOREIGN KEY ([SpacingUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODCore.FK_ODCore_Unit_ODCore_ControlledVocabularies_UnitTypeID...';


GO
ALTER TABLE [ODCore].[Unit]
    ADD CONSTRAINT [FK_ODCore_Unit_ODCore_ControlledVocabularies_UnitTypeID] FOREIGN KEY ([UnitTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_ClassificationScheme_ODCore_ResponsibleParty_CreatedByID...';


GO
ALTER TABLE [ODData].[ClassificationScheme]
    ADD CONSTRAINT [FK_ODData_ClassificationScheme_ODCore_ResponsibleParty_CreatedByID] FOREIGN KEY ([CreatedByID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Coverage_ODCore_SeriesCatalog_SeriesID...';


GO
ALTER TABLE [ODData].[Coverage]
    ADD CONSTRAINT [FK_ODData_Coverage_ODCore_SeriesCatalog_SeriesID] FOREIGN KEY ([SeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_LaboratoryAnalysis_ODCore_ResponsibleParty_LaboratoryID...';


GO
ALTER TABLE [ODData].[LaboratoryAnalysis]
    ADD CONSTRAINT [FK_ODData_LaboratoryAnalysis_ODCore_ResponsibleParty_LaboratoryID] FOREIGN KEY ([LaboratoryID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_LaboratoryAnalysis_ODData_Sample_SampleID...';


GO
ALTER TABLE [ODData].[LaboratoryAnalysis]
    ADD CONSTRAINT [FK_ODData_LaboratoryAnalysis_ODData_Sample_SampleID] FOREIGN KEY ([SampleID]) REFERENCES [ODData].[Sample] ([SampleID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_LaboratoryAnalysis_ODData_TimeSeries_ValueID...';


GO
ALTER TABLE [ODData].[LaboratoryAnalysis]
    ADD CONSTRAINT [FK_ODData_LaboratoryAnalysis_ODData_TimeSeries_ValueID] FOREIGN KEY ([ValueID]) REFERENCES [ODData].[TimeSeries] ([ObservationID]) ON DELETE CASCADE ON UPDATE CASCADE;


GO
PRINT N'Creating ODData.FK_ODData_ObservedCategory_ODData_ClassificationScheme_ClassificationSchemeID...';


GO
ALTER TABLE [ODData].[ObservedCategory]
    ADD CONSTRAINT [FK_ODData_ObservedCategory_ODData_ClassificationScheme_ClassificationSchemeID] FOREIGN KEY ([ClassificationSchemeID]) REFERENCES [ODData].[ClassificationScheme] ([SchemaID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Provenance_ODCore_Method_MethodID...';


GO
ALTER TABLE [ODData].[Provenance]
    ADD CONSTRAINT [FK_ODData_Provenance_ODCore_Method_MethodID] FOREIGN KEY ([MethodID]) REFERENCES [ODCore].[Method] ([MethodID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Provenance_ODCore_ResponsibleParty_ResponsiblePartyID...';


GO
ALTER TABLE [ODData].[Provenance]
    ADD CONSTRAINT [FK_ODData_Provenance_ODCore_ResponsibleParty_ResponsiblePartyID] FOREIGN KEY ([ResponsiblePartyID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Provenance_ODCore_SeriesCatalog_InputSeriesID...';


GO
ALTER TABLE [ODData].[Provenance]
    ADD CONSTRAINT [FK_ODData_Provenance_ODCore_SeriesCatalog_InputSeriesID] FOREIGN KEY ([InputSeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Provenance_ODCore_SeriesCatalog_OutputSeriesID...';


GO
ALTER TABLE [ODData].[Provenance]
    ADD CONSTRAINT [FK_ODData_Provenance_ODCore_SeriesCatalog_OutputSeriesID] FOREIGN KEY ([OutputSeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Sample_ODCore_ControlledVocabularies_SampleTypeID...';


GO
ALTER TABLE [ODData].[Sample]
    ADD CONSTRAINT [FK_ODData_Sample_ODCore_ControlledVocabularies_SampleTypeID] FOREIGN KEY ([SampleTypeID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Sample_ODCore_Method_PreservationMethodID...';


GO
ALTER TABLE [ODData].[Sample]
    ADD CONSTRAINT [FK_ODData_Sample_ODCore_Method_PreservationMethodID] FOREIGN KEY ([PreservationMethodID]) REFERENCES [ODCore].[Method] ([MethodID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_Sample_ODCore_Unit_SampleQuantityUnitID...';


GO
ALTER TABLE [ODData].[Sample]
    ADD CONSTRAINT [FK_ODData_Sample_ODCore_Unit_SampleQuantityUnitID] FOREIGN KEY ([SampleQuantityUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODCore_ControlledVocabularies_CensorID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODCore_ControlledVocabularies_CensorID] FOREIGN KEY ([CensorID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODCore_ControlledVocabularies_VerticalReferenceID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODCore_ControlledVocabularies_VerticalReferenceID] FOREIGN KEY ([VerticalReferenceID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODCore_DataQuality_QualityIndicatorID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODCore_DataQuality_QualityIndicatorID] FOREIGN KEY ([QualityIndicatorID]) REFERENCES [ODCore].[DataQuality] ([DataQualityID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODCore_SeriesCatalog_SeriesID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODCore_SeriesCatalog_SeriesID] FOREIGN KEY ([SeriesID]) REFERENCES [ODCore].[SeriesCatalog] ([SeriesID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODCore_Unit_VerticalOffsetUnitID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODCore_Unit_VerticalOffsetUnitID] FOREIGN KEY ([VerticalOffsetUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODData.FK_ODData_TimeSeries_ODData_ObservedCategory_ObservedCategoryID...';


GO
ALTER TABLE [ODData].[TimeSeries]
    ADD CONSTRAINT [FK_ODData_TimeSeries_ODData_ObservedCategory_ObservedCategoryID] FOREIGN KEY ([ObservedCategoryID]) REFERENCES [ODData].[ObservedCategory] ([CategoryID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_FeatureProperty_ODCore_Feature_FeatureID...';


GO
ALTER TABLE [ODExtensibility].[FeatureProperty]
    ADD CONSTRAINT [FK_ODExtensibility_FeatureProperty_ODCore_Feature_FeatureID] FOREIGN KEY ([FeatureID]) REFERENCES [ODCore].[Feature] ([FeatureID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_FeatureProperty_ODCore_Unit_PropertyUnitID...';


GO
ALTER TABLE [ODExtensibility].[FeatureProperty]
    ADD CONSTRAINT [FK_ODExtensibility_FeatureProperty_ODCore_Unit_PropertyUnitID] FOREIGN KEY ([PropertyUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_FeatureProperty_ODExtensibility_GenericProperty_PropertyID...';


GO
ALTER TABLE [ODExtensibility].[FeatureProperty]
    ADD CONSTRAINT [FK_ODExtensibility_FeatureProperty_ODExtensibility_GenericProperty_PropertyID] FOREIGN KEY ([PropertyID]) REFERENCES [ODExtensibility].[GenericProperty] ([PropertyID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_GenericProperty_ODCore_ResponsibleParty_CreatedByID...';


GO
ALTER TABLE [ODExtensibility].[GenericProperty]
    ADD CONSTRAINT [FK_ODExtensibility_GenericProperty_ODCore_ResponsibleParty_CreatedByID] FOREIGN KEY ([CreatedByID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_MethodProperty_ODCore_Method_MethodID...';


GO
ALTER TABLE [ODExtensibility].[MethodProperty]
    ADD CONSTRAINT [FK_ODExtensibility_MethodProperty_ODCore_Method_MethodID] FOREIGN KEY ([MethodID]) REFERENCES [ODCore].[Method] ([MethodID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_MethodProperty_ODCore_Unit_PropertyUnitID...';


GO
ALTER TABLE [ODExtensibility].[MethodProperty]
    ADD CONSTRAINT [FK_ODExtensibility_MethodProperty_ODCore_Unit_PropertyUnitID] FOREIGN KEY ([PropertyUnitID]) REFERENCES [ODCore].[Unit] ([UnitID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODExtensibility.FK_ODExtensibility_MethodProperty_ODExtensibility_GenericProperty_PropertyID...';


GO
ALTER TABLE [ODExtensibility].[MethodProperty]
    ADD CONSTRAINT [FK_ODExtensibility_MethodProperty_ODExtensibility_GenericProperty_PropertyID] FOREIGN KEY ([PropertyID]) REFERENCES [ODExtensibility].[GenericProperty] ([PropertyID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating ODTranslation.FK_ODTranslation_Dictionary_ODCore_ControlledVocabularies_LocalTermID...';


GO
ALTER TABLE [ODTranslation].[Dictionary]
    ADD CONSTRAINT [FK_ODTranslation_Dictionary_ODCore_ControlledVocabularies_LocalTermID] FOREIGN KEY ([LocalTermID]) REFERENCES [ODCore].[ControlledVocabulary] ([TermID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODTranslation.FK_ODTranslation_Dictionary_ODTranslation_NativeVocabulary_NativeVocabularyID...';


GO
ALTER TABLE [ODTranslation].[Dictionary]
    ADD CONSTRAINT [FK_ODTranslation_Dictionary_ODTranslation_NativeVocabulary_NativeVocabularyID] FOREIGN KEY ([NativeVocabularyID]) REFERENCES [ODTranslation].[NativeVocabulary] ([VocabularyID]) ON DELETE NO ACTION ON UPDATE NO ACTION;


GO
PRINT N'Creating ODTranslation.FK_ODTranslation_NativeVocabulary_ODCore_ResponsibleParty_PublisherID...';


GO
ALTER TABLE [ODTranslation].[NativeVocabulary]
    ADD CONSTRAINT [FK_ODTranslation_NativeVocabulary_ODCore_ResponsibleParty_PublisherID] FOREIGN KEY ([PublisherID]) REFERENCES [ODCore].[ResponsibleParty] ([SourceID]) ON DELETE CASCADE ON UPDATE NO ACTION;


GO
PRINT N'Creating AutoCreatedLocal...';


GO
CREATE ROUTE [AutoCreatedLocal]
    AUTHORIZATION [dbo]
    WITH ADDRESS = N'LOCAL';


GO
PRINT N'Creating ODCore.GetParentFeatureID...';


GO
CREATE FUNCTION [ODCore].[GetParentFeatureID]
(@childhierarchyid [sys].[hierarchyid])
RETURNS INT
AS
BEGIN

DECLARE @parenthierarchyid hierarchyid, @parentFeatureID int;
IF @childhierarchyid.GetLevel()>1
BEGIN
SET @parenthierarchyid = @childhierarchyid.GetAncestor(1);
END
ELSE
BEGIN
SET @parenthierarchyid = @childhierarchyid;
END
SELECT @parentFeatureID=FeatureID from ODCore.Feature where [HierarchyCode]=@parenthierarchyid;

   RETURN(@parentFeatureID)
END


GO
PRINT N'Creating ODData.GetDataFromTrajectory...';


GO
CREATE FUNCTION [ODData].[GetDataFromTrajectory]
(@SeriesID INT)
RETURNS 
    @Observation TABLE (
        [RowID]            INT               IDENTITY (1, 1) NOT NULL,
        [LocalDateTime]    DATETIME          NULL,
        [UTCOffsetHours]   REAL              NULL,
        [ObservationValue] REAL              NULL,
        [GeoPosition]      [sys].[geography] NULL)
AS
BEGIN
INSERT  @Observation (ObservationValue, LocalDateTime, UTCOffsetHours) SELECT  ObservedValue, LocalDatetime, UTCOffsetHours from ODData.TimeSeries where seriesid=@SeriesID order by LocalDateTime ASC;
DECLARE @trajectory geography, @featureid int;
SELECT @featureid = FeatureID from ODCore.SeriesCatalog where SeriesID=@SeriesID;
SELECT @trajectory = Geoposition from ODCore.Feature where Featureid=@featureid
IF (@trajectory.STGeometryType()='LineString')
BEGIN
UPDATE @Observation SET Geoposition=@trajectory.STPointN(RowID);
END
ELSE
BEGIN
UPDATE @Observation SET Geoposition=@trajectory;
END
 RETURN;
 END


GO
PRINT N'Creating ODData.GetRasterMetadata...';


GO
CREATE FUNCTION [ODData].[GetRasterMetadata]
(@FileNameAndLocation NVARCHAR (750), @srsid INT)
RETURNS 
     TABLE (
        [NumberOfRows]    INT               NULL,
        [NumberOfColumns] INT               NULL,
        [NoDataValue]     REAL              NULL,
        [CellSize]        REAL              NULL,
        [BoundingBox]     [sys].[geography] NULL)
AS
 EXTERNAL NAME [MSR.SpatialData].[RasterFunctions].[GetRasterMetadata]


GO
PRINT N'Creating ODData.ImportRaster...';


GO
CREATE FUNCTION [ODData].[ImportRaster]
(@FileNameAndLocation NVARCHAR (750), @srsid INT, @tilerowcount INT, @tilecolumncount INT, @multiplier SMALLINT)
RETURNS 
     TABLE (
        [Grid]         [dbo].[Coverage]  NULL,
        [MinimumValue] REAL              NULL,
        [MaximumValue] REAL              NULL,
        [BoundingBox]  [sys].[geography] NULL)
AS
 EXTERNAL NAME [MSR.SpatialData].[RasterFunctions].[ImportRaster]


GO
PRINT N'Creating ODCore.ControlledVocabulary_View...';


GO
CREATE VIEW [ODCore].[ControlledVocabulary_View]
AS
SELECT     TOP 100000 [ODCore].[ControlledVocabulary].TermID, [ODCore].[ControlledVocabulary].Term, 
                      [ODCore].[ControlledVocabulary].TermDefinition, [ODCore].[TermTableMapping].AttributeReference
FROM         [ODCore].[ControlledVocabulary] INNER JOIN
                      [ODCore].[TermTableMapping] ON [ODCore].[ControlledVocabulary].TermID = [ODCore].[TermTableMapping].TermID
ORDER BY [ODCore].[TermTableMapping].AttributeReference;


GO
PRINT N'Creating ODCore.Feature_View...';


GO
CREATE VIEW [ODCore].[Feature_View]
AS
SELECT     FP.FeatureID, F.FeatureName, Term as FeatureType, G.PropertyName, FP.PropertyValue, U.UnitAbbreviation
FROM         [ODExtensibility].[FeatureProperty] AS FP INNER JOIN
                      [ODExtensibility].[GenericProperty] AS G ON G.PropertyID = FP.PropertyID INNER JOIN
                      [ODCore].[Unit] AS U ON U.UnitID = FP.PropertyUnitID INNER JOIN
                      [ODCore].[Feature] AS F ON F.FeatureID = FP.FeatureID INNER JOIN 
                      [ODCore].[ControlledVocabulary] C on C.TermID=FeatureTypeID;


GO
PRINT N'Creating ODCore.Method_View...';


GO
CREATE VIEW [ODCore].[Method_View]
AS
SELECT     M.MethodName, M.MethodDescription, G.PropertyName, MP.PropertyValue, U.UnitAbbreviation
FROM         [ODExtensibility].[MethodProperty] AS MP INNER JOIN
                      [ODExtensibility].[GenericProperty] AS G ON G.PropertyID = MP.PropertyID INNER JOIN
                      [ODCore].[Unit] AS U ON U.UnitID = MP.PropertyUnitID INNER JOIN
                      [ODCore].[Method] AS M ON M.MethodID = MP.MethodID;


GO
PRINT N'Creating ODCore.MethodProperty_View...';


GO
CREATE VIEW [ODCore].[MethodProperty_View]
AS
SELECT     MP.MethodID, M.MethodName, G.PropertyName, MP.PropertyValue, U.UnitAbbreviation
FROM         [ODExtensibility].[MethodProperty] AS MP INNER JOIN
                      [ODExtensibility].[GenericProperty] AS G ON G.PropertyID = MP.PropertyID INNER JOIN
                      [ODCore].[Unit] AS U ON U.UnitID = MP.PropertyUnitID INNER JOIN
                      [ODCore].[Method]  AS M ON M.MethodID = MP.MethodID;


GO
PRINT N'Creating ODCore.SeriesCatalog_View...';


GO
CREATE VIEW [ODCore].[SeriesCatalog_View]
AS
SELECT     S.SeriesID, F.FeatureName, V.VariableName, M.MethodName, CV.Term AS ObservationType, 
                      CASE WHEN [IsCategorical] = 1 THEN 'True' ELSE 'False' END AS IsCategorical, CVS.Term AS SpatialRepresentation, TS.Description AS TimeSupport, 
                      U.UnitAbbreviation AS Units, S.BeginDateTime, S.EndDateTime, S.ObservationCount, DQ.Description AS OverallQualityIndicator, S.DateCreated, S.DateModified, 
                      S.DateFinalized, S.UpdateFrequency, UF.UnitAbbreviation AS UpdateFrequencyUnit, R.SourceName + ' (' + R.SourceRole + ')' AS Publisher
FROM         [ODCore].[SeriesCatalog] AS S INNER JOIN
                      [ODCore].[Feature] AS F ON F.FeatureID = S.FeatureID INNER JOIN
                      [ODCore].[ObservedVariable] AS V ON V.VariableID = S.VariableID INNER JOIN
                      [ODCore].[Method] AS M ON M.MethodID = S.MethodID INNER JOIN
                      [ODCore].[ControlledVocabulary] AS CV ON CV.TermID = S.ObservationTypeID INNER JOIN
                      [ODCore].[ControlledVocabulary] AS CVS ON CVS.TermID = S.SpatialRepresentationTypeID INNER JOIN
                      [ODCore].[DataQuality] AS DQ ON DQ.DataQualityID = S.OverallQualityIndicatorID INNER JOIN
                      [ODCore].[Unit] AS U ON U.UnitID = S.UnitID INNER JOIN
                      [ODCore].[TimeSupport] AS TS ON TS.TimeSupportID = S.TimeSupportID INNER JOIN
                      [ODCore].[ResponsibleParty] AS R ON R.SourceID = S.OriginatorID LEFT OUTER JOIN
                      [ODCore].[Unit] AS UF ON UF.UnitID = S.UpdateFrequencyUnit;


GO
PRINT N'Creating ODCore.SimpleSite_View...';


GO
CREATE VIEW [ODCore].[SimpleSite_View]
AS
SELECT     K.FeatureID, ODCore.GetParentFeatureID(K.HierarchyCode) AS ParentFeatureID, K.FeatureName AS SiteName, j.SiteCode, K.GeoPosition.STAsText() AS GeoPosition, 
                      'EPSG:' + CAST(K.GeoPosition.STSrid AS varchar(8)) AS SRS, K.GeoPosition.Z AS Elevation
FROM         [ODCore].[Feature] AS K INNER JOIN
                          (SELECT     P.FeatureID, MAX(CASE WHEN PropertyName = 'SiteCode' THEN [PropertyValue] ELSE NULL END) AS SiteCode
                            FROM          [ODCore].[Feature] AS F INNER JOIN
                                                   [ODExtensibility].[FeatureProperty] AS P ON F.FeatureID = P.FeatureID INNER JOIN
                                                   [ODExtensibility].[GenericProperty] AS G ON G.PropertyID = P.PropertyID INNER JOIN
                                                   [ODCore].[ControlledVocabulary] AS CV ON CV.TermID = F.FeatureTypeID
                            WHERE      (CV.Term = 'Sensor')
                            GROUP BY P.FeatureID) AS j ON j.FeatureID = K.FeatureID;


GO
PRINT N'Creating ODCore.TimeSupport_View...';


GO
CREATE VIEW [ODCore].[TimeSupport_View]
AS
SELECT     TOP (1000) [ODCore].[TimeSupport].TimeSupportID, [ODCore].[TimeSupport].IntervalLength, U.UnitDescription AS IntervalLengthUnits, CV.Term AS DataType, 
                      [ODCore].[TimeSupport].Description, CW.Term AS ReportingPrecision
FROM         [ODCore].[TimeSupport] INNER JOIN
                      [ODCore].[Unit] AS U ON U.UnitID = [ODCore].[TimeSupport].IntervalLengthUnitID INNER JOIN
                      [ODCore].[ControlledVocabulary] AS CV ON CV.TermID = [ODCore].[TimeSupport].DataTypeID INNER JOIN
                      [ODCore].[ControlledVocabulary] AS CW ON CW.TermID = [ODCore].[TimeSupport].ReportingPrecisionID;


GO
PRINT N'Creating ODData.Trajectory_View_SeriesID_21...';


GO
CREATE VIEW [ODData].[Trajectory_View_SeriesID_21]
AS
SELECT     S.VariableName, ObservationValue, S.Units, LocalDateTime,UTCOffsetHours, GeoPosition.STAsText() as GeoPosition from ODData.GetDataFromTrajectory(21) T INNER JOIN ODCore.SeriesCatalog_View S on S.SeriesID=21;


GO
PRINT N'Creating Permission...';


GO
GRANT CONNECT TO [dbo]
    AS [dbo];


GO
PRINT N'Creating ODCore.TermTableMapping.MS_Description...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Pointers to locations where a term is used  in Table.ColumnName format', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'TABLE', @level1name = N'TermTableMapping';


GO
PRINT N'Creating ODData.Coverage.MS_Description...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Contains data that varies across its bounding geometry at an instance in time such as gridded data, lake temperature profiles, channel cross-sections or graphs such as rating curves.', @level0type = N'SCHEMA', @level0name = N'ODData', @level1type = N'TABLE', @level1name = N'Coverage';


GO
PRINT N'Creating ODTranslation.NativeVocabulary.MS_Description...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Text of the document from which the vocabulary is obtained if possible. This is meant to provide a pointer to the original content if the link becomes obsolete and a new version of vocabulary supersedes the one in the system.', @level0type = N'SCHEMA', @level0name = N'ODTranslation', @level1type = N'TABLE', @level1name = N'NativeVocabulary';


GO
PRINT N'Creating ODCore.ControlledVocabulary_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ODCore_ControlledVocabularies"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 99
               Right = 189
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ODCore_TermTableMappings"
            Begin Extent = 
               Top = 6
               Left = 227
               Bottom = 84
               Right = 378
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'ControlledVocabulary_View';


GO
PRINT N'Creating ODCore.ControlledVocabulary_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'ControlledVocabulary_View';


GO
PRINT N'Creating ODCore.Feature_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "FP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 123
               Right = 204
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "G"
            Begin Extent = 
               Top = 6
               Left = 242
               Bottom = 123
               Right = 426
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "U"
            Begin Extent = 
               Top = 6
               Left = 464
               Bottom = 123
               Right = 633
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "F"
            Begin Extent = 
               Top = 126
               Left = 38
               Bottom = 243
               Right = 200
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'Feature_View';


GO
PRINT N'Creating ODCore.Feature_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'Feature_View';


GO
PRINT N'Creating ODCore.Method_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "MP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 123
               Right = 204
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "G"
            Begin Extent = 
               Top = 6
               Left = 242
               Bottom = 123
               Right = 426
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "U"
            Begin Extent = 
               Top = 6
               Left = 464
               Bottom = 123
               Right = 633
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "M"
            Begin Extent = 
               Top = 126
               Left = 38
               Bottom = 228
               Right = 216
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 2850
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'Method_View';


GO
PRINT N'Creating ODCore.Method_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'Method_View';


GO
PRINT N'Creating ODCore.SeriesCatalog_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "S"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 123
               Right = 249
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "F"
            Begin Extent = 
               Top = 6
               Left = 287
               Bottom = 123
               Right = 449
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "V"
            Begin Extent = 
               Top = 6
               Left = 487
               Bottom = 123
               Right = 682
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "M"
            Begin Extent = 
               Top = 126
               Left = 38
               Bottom = 228
               Right = 216
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "CV"
            Begin Extent = 
               Top = 126
               Left = 254
               Bottom = 228
               Right = 414
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "CVV"
            Begin Extent = 
               Top = 126
               Left = 452
               Bottom = 228
               Right = 612
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "DQ"
            Begin Extent = 
               Top = 228
               Left = 38
               Bottom = 345
               Right = 221
            End
            DisplayFlags = 344
            TopColumn = 0
         End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'SeriesCatalog_View';


GO
PRINT N'Creating ODCore.SeriesCatalog_View.MS_DiagramPane2...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'Begin Table = "U"
            Begin Extent = 
               Top = 228
               Left = 259
               Bottom = 345
               Right = 428
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "TS"
            Begin Extent = 
               Top = 228
               Left = 466
               Bottom = 345
               Right = 661
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "R"
            Begin Extent = 
               Top = 348
               Left = 38
               Bottom = 465
               Right = 213
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "UF"
            Begin Extent = 
               Top = 348
               Left = 251
               Bottom = 465
               Right = 420
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'SeriesCatalog_View';


GO
PRINT N'Creating ODCore.SeriesCatalog_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'SeriesCatalog_View';


GO
PRINT N'Creating ODCore.SimpleSite_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "K"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 123
               Right = 200
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "j"
            Begin Extent = 
               Top = 6
               Left = 238
               Bottom = 93
               Right = 398
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 2715
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'SimpleSite_View';


GO
PRINT N'Creating ODCore.SimpleSite_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'SimpleSite_View';


GO
PRINT N'Creating ODCore.TimeSupport_View.MS_DiagramPane1...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ODCore_TimeSupport"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 123
               Right = 233
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "U"
            Begin Extent = 
               Top = 6
               Left = 271
               Bottom = 123
               Right = 440
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "CV"
            Begin Extent = 
               Top = 6
               Left = 478
               Bottom = 108
               Right = 638
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "CW"
            Begin Extent = 
               Top = 108
               Left = 478
               Bottom = 210
               Right = 638
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'TimeSupport_View';


GO
PRINT N'Creating ODCore.TimeSupport_View.MS_DiagramPane2...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'End', @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'TimeSupport_View';


GO
PRINT N'Creating ODCore.TimeSupport_View.MS_DiagramPaneCount...';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'ODCore', @level1type = N'VIEW', @level1name = N'TimeSupport_View';


GO

GO
/*
Post-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be appended to the build script.		
 Use SQLCMD syntax to include a file in the post-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the post-deployment script.		
 Example:      :setvar TableName MyTable							
               SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/
-- =============================================
-- Script Template
-- =============================================
SET IDENTITY_INSERT [ODCore].[ResponsibleParty] ON
INSERT [ODCore].[ResponsibleParty] ([SourceID], [SourceGroup], [SourceCode], [SourceName], [SourceDescription], [SourceRole], [ContactName], [ContactEmail], [ContactPhone]) VALUES (0, 0, N'DBAdmin', N'Vijay Dantuluri', N'Database Administrator', N'Curator', N'Vijay Dantuluri', N'vijayd@renci.org', N'919-445-9639')
SET IDENTITY_INSERT [ODCore].[ResponsibleParty] OFF

SET IDENTITY_INSERT [ODCore].[Method] ON
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (1, N'Not Specified', N'Method information not provided')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (2, N'Winkler Method', N'Sodium thiosulfate titration of water sample')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (3, N'Salicylate Method', N'Colorimetric method that uses blue indophenol reaction between ammonia, salicylate and hypochlorite at high pH')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (4, N'USEPA, 2006, Method 1106.1', N'Enterococci in water by membrane filtration using membrane-Enterococcus-Esculin Iron Agar (mE-EIA)')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (5, N'Simpson''s empirical formula', N'Empirical equation for converting wind velocity to wind force in Beaufort scale by G. C. Simpson (1906)')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (6, N'Doppler Radar product', N'Mesoscale vorticity method (MVM) is used in conjunction with the ground-based velocity track display to derive the inner-core vertical velocity from Doppler radar observations')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (7, N'Derived - lookup', N'Categorical values derived from numeric values using a lookup table')
INSERT [ODCore].[Method] ([MethodID], [MethodName], [MethodDescription]) VALUES (8, N'Lugol’s iodine', N'Samples fixed with 2% Lugol''s Iodine solution')
SET IDENTITY_INSERT [ODCore].[Method] OFF

SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] ON
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (0, N'Unspecified', N'To be used when a category is present but not applicable')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (1, N'Dam', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (2, N'Standard Units', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (3, N'Length', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (4, N'Volume', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (5, N'Area', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (6, N'Time', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (7, N'Sensor', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (8, N'Aquifer', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (10, N'Water', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (11, N'Sample', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (13, N'Instantaneous', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (14, N'Density', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (15, N'DateTime', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (16, N'Passed', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (17, N'Failed', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (18, N'Field Observation', N'ObservationType')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (19, N'Temperature', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (20, N'Air', N'Used for air quality and meteorologic observations including wind, precipitation, radiation')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (21, N'Flux', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (22, N'Continuous', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (23, N'Incremental', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (24, N'Mean', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (25, N'Maximum', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (26, N'Minimum', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (28, N'Moving Average', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (29, N'Date', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (30, N'Velocity', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (31, N'Current Density', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (32, N'WS', N'Water Surface')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (33, N'MSL', N'Mean Sea Level')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (34, N'LS', N'Land Surface')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (35, N'SS', N'Snow Surface')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (36, N'SE', N'Sensor Elevation')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (37, N'NGVD29', N'National Geodetic Vertical Datum of 1929')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (38, N'NAVD88', N'North American Vertical Datum of 1988')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (39, N'CGVD28', N'Canadian Geodetic Vertical Datum of 1928')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (40, N'Angle', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (41, N'Pressure', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (42, N'Remote Sensing', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (43, N'Derived', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (44, N'Currency', NULL)
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (45, N'Feature Geometry', N'Observation value doesn''t vary across the geometry')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (46, N'Trajectory', N'Trajectory of a moving vessel represented as a linestring')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (47, N'Grid', N'Gridded data for rasters')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (48, N'Profile/Graph', N'Data in X-Y-Value triples. For example rating curves, cross sections, or lake temperature profiles')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (49, N'nc', N'not censored')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (50, N'lt', N'less than')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (51, N'gt', N'greater than')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (52, N'bdt', N'present but below detection limit')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (53, N'Grab', N'Grab sample')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (54, N'Composite', N'Mixture of multiple grab samples')
SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] OFF

SET IDENTITY_INSERT [ODCore].[DataQuality] ON
INSERT [ODCore].[DataQuality] ([DataQualityID], [Description], [QCRating], [QCResultID], [ResponsiblePartyID], [DateCreated]) VALUES (1, N'Unknown', 0, 0, 0, CAST(0x00009A7100000000 AS DateTime))
INSERT [ODCore].[DataQuality] ([DataQualityID], [Description], [QCRating], [QCResultID], [ResponsiblePartyID], [DateCreated]) VALUES (2, N'Data quality information not provided', 0, 0, 0, CAST(0x00009A7100000000 AS DateTime))
INSERT [ODCore].[DataQuality] ([DataQualityID], [Description], [QCRating], [QCResultID], [ResponsiblePartyID], [DateCreated]) VALUES (3, N'Passed quality assessment tests', 1, 16, 0, CAST(0x00009AF200000000 AS DateTime))
SET IDENTITY_INSERT [ODCore].[DataQuality] OFF

SET IDENTITY_INSERT [ODCore].[Unit]  ON
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (1, 2, N'N/A', N'not applicable')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (2, 3, N'ft', N'international foot')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (3, 4, N'ac-ft', N'acre feet')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (4, 5, N'ac', N'acre')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (5, 5, N'mi^2', N'square mile')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (6, 6, N'yyyy', N'4 digit year')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (7, 14, N'colonies/100ml', N'colonies per 100 milliliters')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (8, 19, N'°C', N'degrees Celsius')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (9, 6, N'd', N'day')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (10, 6, N'min', N'minute')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (11, 6, N'h', N'hour')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (12, 14, N'mg/l', N'milligrams per liter')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (13, 21, N'W/m2', N'watts per square meter')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (14, 30, N'm/s', N'meters per second')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (15, 31, N'W/m-2 mV-1', N'watts per square meter per millivolt')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (16, 2, N'-', N'dimensionless')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (17, 2, N'%', N'percent')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (18, 3, N'µm', N'micrometer')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (19, 40, N'°', N'degrees Azimuth (clockwise from North)')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (20, 41, N'mbar', N'millibar')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (21, 30, N'kt', N'knot')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (22, 44, N'$', N'US Dollars')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (23, 4, N'l', N'liter')
INSERT [ODCore].[Unit]  ([UnitID], [UnitTypeID], [UnitAbbreviation], [UnitDescription]) VALUES (24, 3, N'mm', N'millimeter')
SET IDENTITY_INSERT [ODCore].[Unit]  OFF

INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (0, N'All')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (1, N'ODCore.Feature.FeatureTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (2, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (3, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (4, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (5, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (6, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (7, N'ODCore.Feature.FeatureTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (8, N'ODCore.Feature.FeatureTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (46, N'ODCore.Feature.FeatureTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (10, N'ODCore.ObservedVariable.ObservationMediumID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (11, N'ODCore.SeriesCatalog.ObservationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (53, N'ODData.Sample.SampleTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (13, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (14, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (15, N'ODCore.TimeSupport.ReportingPrecisionID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (16, N'ODCore.DataQuality.QCResultID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (17, N'ODCore.DataQuality.QCResultID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (18, N'ODCore.SeriesCatalog.ObservationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (19, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (20, N'ODCore.ObservedVariable.ObservationMediumID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (21, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (22, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (23, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (24, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (25, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (26, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (28, N'ODCore.TimeSupport.DataTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (29, N'ODCore.TimeSupport.ReportingPrecisionID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (30, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (31, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (32, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (33, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (34, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (35, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (36, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (37, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (38, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (39, N'ODData.Observation.VerticalReferenceID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (40, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (41, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (42, N'ODCore.SeriesCatalog.ObservationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (43, N'ODCore.SeriesCatalog.ObservationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (49, N'ODData.Observation.CensorID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (50, N'ODData.Observation.CensorID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (51, N'ODData.Observation.CensorID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (52, N'ODData.Observation.CensorID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (45, N'ODCore.SeriesCatalog.SpatialRepresentationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (46, N'ODCore.SeriesCatalog.SpatialRepresentationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (47, N'ODCore.SeriesCatalog.SpatialRepresentationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (48, N'ODCore.SeriesCatalog.SpatialRepresentationTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (44, N'ODCore.Unit.UnitTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (54, N'ODData.Sample.SampleTypeID')

--Added as part of State Climatology Office Cronos ECONET integration
SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] ON
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (129, N'battmin', N'Battery voltage')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (130, N'c1sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (131, N'c1tmp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (132, N'c2sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (133, N'c2tmp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (134, N'c3sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (135, N'c3tmp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (136, N'c4sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (137, N'c4tmp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (138, N'c5sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (139, N'c5tmp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (140, N'diravgwind', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (141, N'diravgwind02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (142, N'evap', N'Evapotranspiration')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (143, N'gust', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (144, N'gust02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (145, N'gust06', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (146, N'gustavg', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (147, N'gustdir', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (148, N'gustmax', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (149, N'gustmax02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (150, N'gustmaxdir', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (151, N'gustmaxdir02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (152, N'gustmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (153, N'gustmaxtime02', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (154, N'par', N'Radiation, net PAR')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (155, N'paravg', N'Radiation, net PAR')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (156, N'parmax', N'Radiation, net PAR')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (157, N'parmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (158, N'precip', N'Precipitation')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (159, N'pres', N'Barometric pressure')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (160, N'presavg', N'Barometric pressure')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (161, N'presmax', N'Barometric pressure')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (162, N'presmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (163, N'presmin', N'Barometric pressure')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (164, N'presmintime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (165, N'rh', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (166, N'rh10', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (167, N'rhavg', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (168, N'rhavg10', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (169, N'rhmax', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (170, N'rhmax10', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (171, N'rhmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (172, N'rhmaxtime10', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (173, N'rhmin', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (174, N'rhmin10', N'Relative humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (175, N'rhmintime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (176, N'rhmintime10', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (177, N'sm', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (178, N'smavg', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (179, N'smmax', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (180, N'smmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (181, N'smmin', N'Volumetric water content')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (182, N'smmintime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (183, N'speedavgwind', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (184, N'speedavgwind02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (185, N'sr', N'Radiation, net')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (186, N'sravg', N'Radiation, net')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (187, N'srmax', N'Radiation, net')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (188, N'srmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (189, N'st', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (190, N'stavg', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (191, N'stmax', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (192, N'stmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (193, N'stmin', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (194, N'stmintime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (195, N'temp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (196, N'temp10', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (197, N'tempavg', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (198, N'tempavg10', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (199, N'tempmax', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (200, N'tempmax10', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (201, N'tempmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (202, N'tempmaxtime10', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (203, N'tempmin', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (204, N'tempmin10', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (205, N'tempmintime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (206, N'tempmintime10', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (207, N'wd', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (208, N'wd02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (209, N'wd06', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (210, N'wdavg', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (211, N'wdavg02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (212, N'wdmax', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (213, N'wdmax02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (214, N'winddiravg', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (215, N'windsd', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (216, N'windsd02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (217, N'ws', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (218, N'ws02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (219, N'ws06', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (220, N'wsavg', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (221, N'wsavg02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (222, N'wsmax', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (223, N'wsmax02', N'Wind speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (224, N'wsmaxdir', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (225, N'wsmaxdir02', N'Wind direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (226, N'wsmaxtime', N'Time')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (227, N'wsmaxtime02', N'Time')
SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] OFF

INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (129, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (130, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (131, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (132, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (133, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (134, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (135, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (136, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (137, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (138, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (139, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (140, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (141, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (142, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (143, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (144, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (145, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (146, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (147, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (148, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (149, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (150, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (151, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (152, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (153, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (154, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (155, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (156, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (157, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (158, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (159, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (160, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (161, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (162, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (163, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (164, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (165, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (166, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (167, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (168, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (169, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (170, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (171, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (172, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (173, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (174, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (175, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (176, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (177, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (178, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (179, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (180, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (181, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (182, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (183, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (184, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (185, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (186, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (187, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (188, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (189, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (190, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (191, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (192, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (193, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (194, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (195, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (196, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (197, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (198, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (199, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (200, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (201, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (202, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (203, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (204, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (205, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (206, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (207, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (208, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (209, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (210, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (211, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (212, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (213, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (214, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (215, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (216, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (217, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (218, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (219, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (220, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (221, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (222, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (223, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (224, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (225, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (226, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (227, N'ODCore.ObservedVariable.VariableCodeID')

--Added as part of RENCI Brunswick County Flood Sensors integration
SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] ON
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (228, N'BaseStation', N'Feature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (229, N'air_pressure', N'Barometric Pressure')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (230, N'air_temp', N'Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (231, N'hail_acc', N'Hail Accumulation')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (232, N'hail_duration', N'Hail Duration')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (233, N'hail_intensity', N'Hail Intensity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (234, N'hail_peak_intensity', N'Hail Peak Intensity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (235, N'heating_temp', N'Heating Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (236, N'heating_voltage', N'Heating Voltage')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (237, N'qual', N'Measurement Quality')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (238, N'rain_acc', N'Rain Accumulation')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (239, N'rain_duration', N'Rain Duration')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (240, N'rain_intensity', N'Rain Intensity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (241, N'rain_peak_intensity', N'Rain Peak Intensity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (242, N'ref_voltage', N'Reference Voltage')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (243, N'rel_humidity', N'Relative Humidity')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (244, N'spot_voltage', N'Battery Voltage')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (245, N'supply_voltage', N'Supply Voltage')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (246, N'water_dist', N'Water level')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (247, N'water_lev', N'Water level')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (248, N'water_temp', N'Water Temperature')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (249, N'winddir_avg', N'Wind Direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (250, N'winddir_max', N'Wind Direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (251, N'winddir_min', N'Wind Direction')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (252, N'windspeed_avg', N'Wind Speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (253, N'windspeed_max', N'Wind Speed')
INSERT [ODCore].[ControlledVocabulary] ([TermID], [Term], [TermDefinition]) VALUES (254, N'windspeed_min', N'Wind Speed')
SET IDENTITY_INSERT [ODCore].[ControlledVocabulary] OFF

INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (228, N'ODCore.Feature.FeatureTypeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (229, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (230, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (231, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (232, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (233, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (234, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (235, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (236, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (237, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (238, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (239, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (240, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (241, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (242, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (243, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (244, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (245, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (246, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (247, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (248, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (249, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (250, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (251, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (252, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (253, N'ODCore.ObservedVariable.VariableCodeID')
INSERT [ODCore].[TermTableMapping] ([TermID], [AttributeReference]) VALUES (254, N'ODCore.ObservedVariable.VariableCodeID')


-- =============================================
-- Script Template
-- =============================================

INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (1, N'Anderson Landuse/Lancover Classification Level I', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (2, N'Anderson Landuse/Lancover Classification Level II', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (3, N'U.S. Army Corps of Engineers Dam Types', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (4, N'U.S. Army Corps of Engineers Dam Purposes', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (5, N'U.S. Army Corps of Engineers Owner Types', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (6, N'U.S. Army Corps of Engineers Dam Hazard Codes', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (9, N'USGS Rock Type Classification', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (10, N'Non-categorical', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (11, N'Beaufort Wind Scale', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (12, N'Cyclone Stage Classification', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (13, N'Saffir-Simpson Hurricane Scale', 0)
INSERT [ODData].[ClassificationScheme] ([SchemaID], [SchemaName], [CreatedByID]) VALUES (14, N'Not Applicable', 0)

SET IDENTITY_INSERT [ODData].[ObservedCategory] ON
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (1, N'/1/', N'1', N'Urban or Built-up Land', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (2, N'/2/', N'2', N'Agricultural Land', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (3, N'/3/', N'3', N'Rangeland', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (4, N'/4/', N'4', N'Forest Land', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (5, N'/5/', N'5', N'Water', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (6, N'/6/', N'6', N'Wetland', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (7, N'/7/', N'7', N'Barren Land', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (8, N'/8/', N'8', N'Tundra', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (9, N'/9/', N'9', N'Perennial Snow or Ice', 1)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (10, N'/1/1/', N'11', N'Residential', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (11, N'/1/2/', N'12', N'Commercial and Services', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (12, N'/1/3/', N'13', N'Industrial', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (13, N'/1/4/', N'14', N'Transportation', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (14, N'/1/5/', N'15', N'Industrial and Commercial Complexes', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (15, N'/1/6/', N'16', N'Mixed Urban or Built-up Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (16, N'/1/7/', N'17', N'Other Urban or Built-up Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (17, N'/2/1/', N'21', N'Cropland and Pasture', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (18, N'/2/2/', N'22', N'Orchards, Groves, Vineyards, Nurseries, and Ornamental Horticultural', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (19, N'/2/3/', N'23', N'Confined Feeding Operations', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (20, N'/2/4/', N'24', N'Other Agricultural Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (21, N'/3/1/', N'31', N'Herbaceous Rangeland', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (22, N'/3/2/', N'32', N'Shrub and Brush Rangeland', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (23, N'/3/3/', N'33', N'Mixed Rangeland', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (24, N'/4/1/', N'41', N'Deciduous Forest Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (25, N'/4/2/', N'42', N'Evergreen Forest Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (26, N'/4/3/', N'43', N'Mixed Forest Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (27, N'/5/1/', N'51', N'Streams and Canals', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (28, N'/5/2/', N'52', N'Lakes', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (29, N'/5/3/', N'53', N'Reservoirs', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (30, N'/5/4/', N'54', N'Bays and Estuaries', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (31, N'/6/1/', N'61', N'Forested Wetland', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (32, N'/6/2/', N'62', N'Nonforested Wetland', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (33, N'/7/1/', N'71', N'Dry Salt Flats', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (34, N'/7/2/', N'72', N'Beaches', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (35, N'/7/3/', N'73', N'Sandy Areas other than Beaches', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (36, N'/7/4/', N'74', N'Bare Exposed Rock', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (37, N'/7/5/', N'75', N'Strip Mines Quarries, and Gravel Pits', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (38, N'/7/6/', N'76', N'Transitional Areas', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (39, N'/7/7/', N'77', N'Mixed Barren Land', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (40, N'/8/1/', N'81', N'Shrub and Brush Tundra', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (41, N'/8/2/', N'82', N'Herbaceous Tundra', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (42, N'/8/3/', N'83', N'Bare Ground Tundra', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (43, N'/8/4/', N'84', N'Wet Tundra', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (44, N'/8/5/', N'85', N'Mixed Tundra', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (45, N'/9/1/', N'91', N'Perennial Snowfields', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (46, N'/9/2/', N'92', N'Glaciers', 2)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (47, N'/10/', N'CB', N'Buttress', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (48, N'/11/', N'CN', N'Concrete', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (49, N'/12/', N'ER', N'Rockfill', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (50, N'/13/', N'MS', N'Masonry', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (51, N'/14/', N'MV', N'Multi-arch', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (52, N'/15/', N'OT', N'Other', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (53, N'/16/', N'PG', N'Gravity', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (54, N'/17/', N'RE', N'Earth', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (55, N'/18/', N'ST', N'Stone', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (56, N'/19/', N'TC', N'Timber crib', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (57, N'/20/', N'VA', N'Arch', 3)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (58, N'/21/', N'C', N'Flood control and storm water management', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (59, N'/22/', N'D', N'Debris control', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (60, N'/23/', N'F', N'Fish and wildlife pond', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (61, N'/24/', N'H', N'Hydroelectric', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (62, N'/25/', N'I', N'Irrigation', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (63, N'/26/', N'N', N'Navigation', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (64, N'/27/', N'O', N'Other', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (65, N'/28/', N'P', N'Fire protection, stock, or small farm pond', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (66, N'/29/', N'R', N'Recreation', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (67, N'/30/', N'S', N'Water supply', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (68, N'/31/', N'T', N'Tailings', 4)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (69, N'/32/', N'F', N'Federal agency', 5)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (70, N'/33/', N'L', N'County, City, Regional, or other similar local', 5)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (71, N'/34/', N'P', N'Individual or individuals, or private company', 5)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (72, N'/35/', N'S', N'State or State agency', 5)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (73, N'/36/', N'U', N'Public utility', 5)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (74, N'/37/', N'L', N'Low. Failure or misoperation results in no probable loss of human life and low economic and/or environmental loss.  Losses are principally limited to the owner''s property', 6)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (75, N'/38/', N'S', N'Significant. Failure or misoperation results in no probable loss of human life but can cause economic loss, environmental damage, disruption of lifeline facilities, or impact other concerns.  These dams are often located in predominantly rural or agricultural areas but could be located in areas with population and significant infrastructure.', 6)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (76, N'/39/', N'H', N'High. Failure or misoperation will probably cause loss of human life.', 6)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (77, N'/40/', N'U', N'Unknown', 6)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (78, N'/41/', N'100', N'Unconsolidated sand and gravel aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (79, N'/42/', N'999', N'Other', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (80, N'/43/', N'200', N'Semiconsolidated sand aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (81, N'/44/', N'300', N'Sandstone aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (82, N'/45/', N'400', N'Carbonate-rock aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (83, N'/46/', N'500', N'Sandstone and carbonate-rock aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (84, N'/47/', N'600', N'Igneous and metamorphic-rock aquifers', 9)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (86, N'/85/', N'Non-categorical', N'Observation result is not categorical', 10)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (88, N'/86/', N'0', N'Calm, wind speed <0.3 m/s, sea surface smooth and mirror-like, on land smoke rises vertically', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (89, N'/86/', N'1', N'Light Air, wind speed 0.3-1.5 m/s, scaly ripples, no foam crests on sea surface, smoke drift indicates wind direction, still wind vaneson on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (90, N'/88/', N'2', N'Light Breeze, wind speed 1.5-3.3 m/s, small wavelets, crests glassy, no breaking on sea surface, Wind felt on face, leaves rustle, vanes begin to move on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (91, N'/89/', N'3', N'Gentle Breeze, wind speed 3.3-5.5 m/s, large wavelets, crests begin to break, scattered whitecaps on sea surface, wind felt on face, leaves and small twigs constantly moving, light flags extended on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (92, N'/90/', N'4', N'Moderate Breeze, wind speed 5.5-8.0 m/s, large wavelets, small waves 1-4 ft. becoming longer, numerous whitecaps on sea surface, dust, leaves, and loose paper lifted, small tree branches move on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (93, N'/91/', N'5', N'Fresh Breeze, wind speed 8.0-10.8 m/s, moderate waves 4-8 ft taking longer form, many whitecaps, some spray on sea surface, small trees in leaf begin to sway on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (94, N'/92/', N'6', N'Strong Breeze, wind speed 10.8-13.9 m/s, larger waves 8-13 ft, whitecaps common, more spray on sea surface, larger tree branches moving, whistling in wires on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (95, N'/93/', N'7', N'Near Gale, wind speed 13.9-17.2 m/s, sea heaps up, waves 13-20 ft, white foam streaks off breakers on sea surface, whole trees moving, resistance felt walking against wind on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (96, N'/94/', N'8', N'Gale, wind speed 17.2-20.7 m/s, moderately high (13-20 ft) waves of greater length, edges of crests begin to break into spindrift, foam blown in streaks on sea surface, whole trees in motion, resistance felt walking against wind on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (97, N'/95/', N'9', N'Strong Gale, wind speed 20.7-24.5 m/s, high waves (20 ft), sea begins to roll, dense streaks of foam, spray may reduce visibility on sea surface, slight structural damage occurs, slate blows off roofs on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (98, N'/96/', N'10', N'Storm, wind speed 24.5-28.4 m/s, very high waves (20-30 ft) with overhanging crests, sea white with densely blown foam, heavy rolling, lowered visibility on sea surface, seldom experienced on land, trees broken or uprooted, (considerable structural damage) on land', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (99, N'/97/', N'11', N'Violent Storm, wind speed 28.4-32.6 m/s, exceptionally high (30-45 ft) waves, foam patches cover sea, visibility more reduced', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (100, N'/98/', N'12', N'Hurricane, wind speed >=32.6 m/s, air filled with foam, waves over 45 ft, sea completely white with driving spray, visibility greatly reduced', 11)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (101, N'/101/', N'Tropical Depression', N'A tropical cyclone in which the maximum sustained surface winds are 38 miles per hour (33 knots) or less. Characteristically having one or more closed isobars, it may form slowly from a tropical disturbance or an easterly wave which has continued to organize.', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (102, N'/102/', N'Tropical Storm', N'A tropical cyclone in which the maximum sustained surface winds are from 39 miles per hour (34 knots) to 73 miles per hour (63 knots). At this point, the system is given a name to identify and track it.', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (103, N'/103/', N'Hurricane', N'The name for a tropical cyclone with sustained winds of 74 miles per hour (65 knots) or greater in the North Atlantic Ocean, Caribbean Sea, Gulf of Mexico, and in the eastern North Pacific Ocean. This same tropical cyclone is known as a typhoon in the western Pacific and a cyclone in the Indian Ocean.', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (104, N'/104/', N'Tropical Disturbance', N'An area of organized convection, originating in the tropics and occasionally the subtropics, that maintains its identity for 24 hours or more. It is often the first developmental stage of any subsequent tropical depression, tropical storm, or hurricane.', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (106, N'/105/', N'Extratropical', N'Any cyclone that is no longer tropical in origin. Generally considered to be a migratory frontal cyclone found in the middle and high latitudes. An extratropical storm is a cyclone that no longer derives its energy source from the processes involved in sustaining a tropical cyclone, but thrives on baroclinic processes; i.e., the temperature contrast between warm and cold air masses.', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (107, N'/107/', N'Tropical wave', N'A trough of low pressure in the trade-wind easterlies', 12)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (108, N'/108/', N'1', N'Winds 74-95 mph (64-82 kt or 119-153 km/hr). No significant damage to building structures. Damage primarily to unanchored mobile homes, shrubbery, and trees. Some damage to poorly constructed signs. Also, some coastal road flooding and minor pier damage.', 13)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (109, N'/109/', N'2', N'Winds 96-110 mph (83-95 kt or 154-177 km/hr). Some roofing material, door, and window damage of buildings. Considerable damage to shrubbery and trees with some trees blown down. Considerable damage to mobile homes, poorly constructed signs, and piers. Coastal and low-lying escape routes flood 2-4 hours before arrival of the hurricane center.', 13)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (112, N'/111/', N'3', N'Winds 111-130 mph (96-113 kt or 178-209 km/hr). Some structural damage to small residences and utility buildings with a minor amount of curtainwall failures. Damage to shrubbery and trees with foliage blown off trees and large trees blown down. Mobile homes and poorly constructed signs are destroyed. Terrain continuously lower than 5 ft above mean sea level may be flooded inland 8 miles (13 km) or more. ', 13)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (113, N'/112/', N'4', N'Winds 131-155 mph (114-135 kt or 210-249 km/hr). More extensive curtainwall failures with some complete roof structure failures on small residences. Shrubs, trees, and all signs are blown down. Complete destruction of mobile homes. Extensive damage to doors and windows. Terrain lower than 10 ft above sea level may be flooded requiring massive evacuation of residential areas as far inland as 6 miles (10 km). ', 13)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (114, N'/113/', N'5', N'Winds greater than 155 mph (135 kt or 249 km/hr). Complete roof failure on many residences and industrial buildings. Some complete building failures with small utility buildings blown over or away. Complete destruction of mobile homes.  Major damage to lower floors of all structures located less than 15 ft above sea level and within 500 yards of the shoreline. Massive evacuation of residential areas on low ground within 5-10 miles (8-16 km) of the shoreline may be required. ', 13)
INSERT [ODData].[ObservedCategory] ([CategoryID], [HierarchyCode], [CategoryCode], [CategoryDescription], [ClassificationSchemeID]) VALUES (115, N'/114/', N'-9999', N'Missing or does not fall into any relevant category', 14)
SET IDENTITY_INSERT [ODData].[ObservedCategory] OFF
-- =============================================
-- Script Template
-- =============================================
SET IDENTITY_INSERT [ODTranslation].[NativeVocabulary] ON
INSERT [ODTranslation].[NativeVocabulary] ([VocabularyID], [PublisherID], [DownloadedFromURL], [DateDownloaded], [VocabularyText], [VocabularyType]) VALUES (1, 0, NULL, NULL, NULL, N'VariableCode');
INSERT [ODTranslation].[NativeVocabulary] ([VocabularyID], [PublisherID], [DownloadedFromURL], [DateDownloaded], [VocabularyText], [VocabularyType]) VALUES (2, 0, N'http://www.example.com/GetVocabulary.ashx?type=censoring', CAST(0x00009A9300000000 AS DateTime), N'<vocabularyElement>&lt;</vocabularyElement><vocabularyElement>&gt;</vocabularyElement><vocabularyElement>exact</vocabularyElement>', N'CensorCode')
INSERT [ODTranslation].[NativeVocabulary] ([VocabularyID], [PublisherID], [DownloadedFromURL], [DateDownloaded], [VocabularyText], [VocabularyType]) VALUES (3, 0, N'', CAST(0x00009BF900000000 AS DateTime), N'', N'VariableCode')
SET IDENTITY_INSERT [ODTranslation].[NativeVocabulary] OFF

INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'&lt;', 2, 50, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'&gt;', 2, 51, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'exact', 2, 49, CAST(0x00009BA400000000 AS DateTime))

--Added as part of State Climatology Office Cronos ECONET integration
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'battmin', 3, 129, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c1sm', 3, 130, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c1tmp', 3, 131, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c2sm', 3, 132, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c2tmp', 3, 133, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c3sm', 3, 134, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c3tmp', 3, 135, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c4sm', 3, 136, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c4tmp', 3, 137, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c5sm', 3, 138, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'c5tmp', 3, 139, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'diravgwind', 3, 140, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'diravgwind02', 3, 141, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'evap', 3, 142, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gust', 3, 143, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gust02', 3, 144, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gust06', 3, 145, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustavg', 3, 146, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustdir', 3, 147, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmax', 3, 148, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmax02', 3, 149, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmaxdir', 3, 150, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmaxdir02', 3, 151, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmaxtime', 3, 152, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'gustmaxtime02', 3, 153, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'par', 3, 154, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'paravg', 3, 155, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'parmax', 3, 156, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'parmaxtime', 3, 157, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'precip', 3, 158, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'pres', 3, 159, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'presavg', 3, 160, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'presmax', 3, 161, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'presmaxtime', 3, 162, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'presmin', 3, 163, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'presmintime', 3, 164, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rh', 3, 165, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rh10', 3, 166, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhavg', 3, 167, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhavg10', 3, 168, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmax', 3, 169, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmax10', 3, 170, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmaxtime', 3, 171, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmaxtime10', 3, 172, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmin', 3, 173, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmin10', 3, 174, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmintime', 3, 175, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rhmintime10', 3, 176, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'sm', 3, 177, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'smavg', 3, 178, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'smmax', 3, 179, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'smmaxtime', 3, 180, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'smmin', 3, 181, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'smmintime', 3, 182, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'speedavgwind', 3, 183, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'speedavgwind02', 3, 184, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'sr', 3, 185, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'sravg', 3, 186, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'srmax', 3, 187, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'srmaxtime', 3, 188, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'st', 3, 189, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'stavg', 3, 190, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'stmax', 3, 191, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'stmaxtime', 3, 192, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'stmin', 3, 193, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'stmintime', 3, 194, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'temp', 3, 195, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'temp10', 3, 196, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempavg', 3, 197, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempavg10', 3, 198, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmax', 3, 199, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmax10', 3, 200, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmaxtime', 3, 201, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmaxtime10', 3, 202, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmin', 3, 203, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmin10', 3, 204, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmintime', 3, 205, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'tempmintime10', 3, 206, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wd', 3, 207, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wd02', 3, 208, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wd06', 3, 209, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wdavg', 3, 210, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wdavg02', 3, 211, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wdmax', 3, 212, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wdmax02', 3, 213, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'winddiravg', 3, 214, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'windsd', 3, 215, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'windsd02', 3, 216, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'ws', 3, 217, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'ws02', 3, 218, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'ws06', 3, 219, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsavg', 3, 220, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsavg02', 3, 221, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmax', 3, 222, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmax02', 3, 223, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmaxdir', 3, 224, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmaxdir02', 3, 225, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmaxtime', 3, 226, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'wsmaxtime02', 3, 227, CAST(0x00009BA400000000 AS DateTime))

--Added as part of RENCI Brunswick County Flood Sensors integration
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'air_pressure', 3, 229, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'air_temp', 3, 230, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'hail_acc', 3, 231, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'hail_duration', 3, 232, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'hail_intensity', 3, 233, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'hail_peak_intensity', 3, 234, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'heating_temp', 3, 235, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'heating_voltage', 3, 236, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'qual', 3, 237, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rain_acc', 3, 238, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rain_duration', 3, 239, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rain_intensity', 3, 240, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rain_peak_intensity', 3, 241, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'ref_voltage', 3, 242, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'rel_humidity', 3, 243, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'spot_voltage', 3, 244, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'supply_voltage', 3, 245, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'water_dist', 3, 246, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'water_lev', 3, 247, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'water_temp', 3, 248, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'winddir_avg', 3, 249, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'winddir_max', 3, 250, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'winddir_min', 3, 251, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'windspeed_avg', 3, 252, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'windspeed_max', 3, 253, CAST(0x00009BA400000000 AS DateTime))
INSERT [ODTranslation].[Dictionary] ([NativeTerm], [NativeVocabularyID], [LocalTermID], [DateCreated]) VALUES (N'windspeed_min', 3, 254, CAST(0x00009BA400000000 AS DateTime))

GO

GO

GO
IF EXISTS (SELECT 1
           FROM   [master].[dbo].[sysdatabases]
           WHERE  [name] = N'$(DatabaseName)')
    BEGIN
        DECLARE @VarDecimalSupported AS BIT;
        SELECT @VarDecimalSupported = 0;
        IF ((ServerProperty(N'EngineEdition') = 3)
            AND (((@@microsoftversion / power(2, 24) = 9)
                  AND (@@microsoftversion & 0xffff >= 3024))
                 OR ((@@microsoftversion / power(2, 24) = 10)
                     AND (@@microsoftversion & 0xffff >= 1600))))
            SELECT @VarDecimalSupported = 1;
        IF (@VarDecimalSupported > 0)
            BEGIN
                EXECUTE sp_db_vardecimal_storage_format N'$(DatabaseName)', 'ON';
            END
    END


GO
ALTER DATABASE [$(DatabaseName)]
    SET MULTI_USER 
    WITH ROLLBACK IMMEDIATE;


GO
